(&self, other: &Box<dyn Value>)
| 52 | } |
| 53 | |
| 54 | fn add_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 55 | if let Some(other_int) = other.as_any().downcast_ref::<IntValue>() { |
| 56 | let value = self.value + other_int.value; |
| 57 | return Ok(Box::new(IntValue::new(value))); |
| 58 | } |
| 59 | Err("Unexpected type to perform `+` with".to_string()) |
| 60 | } |
| 61 | |
| 62 | fn sub_op(&self, other: &Box<dyn Value>) -> Result<Box<dyn Value>, String> { |
| 63 | if let Some(other_int) = other.as_any().downcast_ref::<IntValue>() { |