(
env: &mut Environment,
expr: &ArithmeticExpr,
titles: &[String],
object: &Vec<Box<dyn Value>>,
)
| 333 | } |
| 334 | |
| 335 | fn evaluate_arithmetic( |
| 336 | env: &mut Environment, |
| 337 | expr: &ArithmeticExpr, |
| 338 | titles: &[String], |
| 339 | object: &Vec<Box<dyn Value>>, |
| 340 | ) -> Result<Box<dyn Value>, String> { |
| 341 | let lhs = evaluate_expression(env, &expr.left, titles, object)?; |
| 342 | let rhs = evaluate_expression(env, &expr.right, titles, object)?; |
| 343 | match expr.operator { |
| 344 | ArithmeticOperator::Plus => lhs.add_op(&rhs), |
| 345 | ArithmeticOperator::Minus => lhs.sub_op(&rhs), |
| 346 | ArithmeticOperator::Star => lhs.mul_op(&rhs), |
| 347 | ArithmeticOperator::Slash => lhs.div_op(&rhs), |
| 348 | ArithmeticOperator::Modulus => lhs.rem_op(&rhs), |
| 349 | ArithmeticOperator::Exponentiation => lhs.caret_op(&rhs), |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | fn evaluate_comparison( |
| 354 | env: &mut Environment, |
no test coverage detected
searching dependent graphs…