Returns a reference to the value associated with the given path, if there is one.
(&self, path: &Rc<Path>)
| 218 | |
| 219 | /// Returns a reference to the value associated with the given path, if there is one. |
| 220 | pub fn value_at(&self, path: &Rc<Path>) -> Option<Rc<SymbolicValue>> { |
| 221 | if self.numerical_domain.contains(path) { |
| 222 | let interval = self.numerical_domain.get_interval(path); |
| 223 | if let Ok(const_int) = Integer::try_from(interval) { |
| 224 | Some(SymbolicValue::make_from( |
| 225 | Expression::CompileTimeConstant(ConstantValue::Int(const_int)), |
| 226 | 1, |
| 227 | )) |
| 228 | } else { |
| 229 | let e = Expression::Numerical(path.clone()); |
| 230 | Some(SymbolicValue::make_from(e, 1)) |
| 231 | } |
| 232 | } else if self.nullness_domain.contains(path) { |
| 233 | Some(SymbolicValue::make_from( |
| 234 | Expression::Variable { |
| 235 | path: path.clone(), |
| 236 | var_type: crate::analysis::memory::expression::ExpressionType::Reference, |
| 237 | }, |
| 238 | 1, |
| 239 | )) |
| 240 | } else { |
| 241 | None |
| 242 | } |
| 243 | } |
| 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>) { |
no test coverage detected