Updates the path to value map so that the given path now points to the given value.
(&mut self, path: Rc<Path>, value: Rc<SymbolicValue>)
| 244 | |
| 245 | /// Updates the path to value map so that the given path now points to the given value. |
| 246 | pub fn update_value_at(&mut self, path: Rc<Path>, value: Rc<SymbolicValue>) { |
| 247 | debug!("Updating value at {:?}, value: {:?}", path, value); |
| 248 | |
| 249 | if value.is_bottom() || value.is_top() { |
| 250 | self.numerical_domain.forget(&path); |
| 251 | self.nullness_domain.forget(&path); |
| 252 | return; |
| 253 | } |
| 254 | |
| 255 | let nullness = self.infer_reference_nullness(&value); |
| 256 | self.update_nullness_at(&path, nullness); |
| 257 | |
| 258 | match &value.expression { |
| 259 | Expression::Numerical(rpath) => { |
| 260 | self.numerical_domain |
| 261 | .assign_var(path.clone(), rpath.clone()); |
| 262 | } |
| 263 | Expression::CompileTimeConstant(c) => { |
| 264 | if let Some(i) = c.try_get_integer() { |
| 265 | self.numerical_domain.assign_int(path.clone(), i); |
| 266 | } else { |
| 267 | self.numerical_domain.forget(&path); |
| 268 | } |
| 269 | } |
| 270 | Expression::Variable { |
| 271 | path: rpath, |
| 272 | var_type, |
| 273 | } if var_type.is_integer() => { |
| 274 | self.numerical_domain |
| 275 | .assign_var(path.clone(), rpath.clone()); |
| 276 | } |
| 277 | Expression::Add { left, right } => { |
| 278 | if !self.assign_integer_binary_expression( |
| 279 | path.clone(), |
| 280 | NumericalOperation::Add, |
| 281 | left, |
| 282 | right, |
| 283 | ) { |
| 284 | self.numerical_domain.forget(&path); |
| 285 | } |
| 286 | } |
| 287 | Expression::Sub { left, right } => { |
| 288 | if !self.assign_integer_binary_expression( |
| 289 | path.clone(), |
| 290 | NumericalOperation::Sub, |
| 291 | left, |
| 292 | right, |
| 293 | ) { |
| 294 | self.numerical_domain.forget(&path); |
| 295 | } |
| 296 | } |
| 297 | Expression::Mul { left, right } => { |
| 298 | if !self.assign_integer_binary_expression( |
| 299 | path.clone(), |
| 300 | NumericalOperation::Mul, |
| 301 | left, |
| 302 | right, |
| 303 | ) { |
no test coverage detected