Returns an element that is "*self".
(&self, target_type: ExpressionType)
| 751 | |
| 752 | /// Returns an element that is "*self". |
| 753 | fn dereference(&self, target_type: ExpressionType) -> Rc<SymbolicValue> { |
| 754 | match &self.expression { |
| 755 | Expression::Bottom | Expression::Top => self.clone(), |
| 756 | Expression::Cast { |
| 757 | operand, |
| 758 | target_type: _, |
| 759 | } => operand.dereference(target_type), |
| 760 | Expression::CompileTimeConstant(..) => self.clone(), |
| 761 | Expression::Reference(path) => { |
| 762 | if let PathEnum::HeapBlock { value } = &path.value { |
| 763 | value.clone() |
| 764 | } else { |
| 765 | SymbolicValue::make_from( |
| 766 | Expression::Variable { |
| 767 | path: path.clone(), |
| 768 | var_type: target_type, |
| 769 | }, |
| 770 | 1, |
| 771 | ) |
| 772 | } |
| 773 | } |
| 774 | Expression::Variable { path, .. } => SymbolicValue::make_from( |
| 775 | Expression::Variable { |
| 776 | path: Path::new_qualified(path.clone(), Rc::new(PathSelector::Deref)), |
| 777 | var_type: target_type, |
| 778 | }, |
| 779 | 1, |
| 780 | ), |
| 781 | Expression::Widen { path, operand } => operand.dereference(target_type).widen(path), |
| 782 | _ => { |
| 783 | info!( |
| 784 | "found unhandled expression that is of type reference: {:?}", |
| 785 | self.expression |
| 786 | ); |
| 787 | SymbolicValue::make_typed_unknown(target_type) |
| 788 | } |
| 789 | } |
| 790 | } |
| 791 | |
| 792 | /// Returns an element that is "self == other". |
| 793 | fn equals(&self, other: Rc<SymbolicValue>) -> Rc<SymbolicValue> { |