MCPcopy Create free account
hub / github.com/AmrDeveloper/GQL / evaluate_arithmetic

Function evaluate_arithmetic

crates/gitql-engine/src/engine_evaluator.rs:335–351  ·  view source on GitHub ↗
(
    env: &mut Environment,
    expr: &ArithmeticExpr,
    titles: &[String],
    object: &Vec<Box<dyn Value>>,
)

Source from the content-addressed store, hash-verified

333}
334
335fn 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
353fn evaluate_comparison(
354 env: &mut Environment,

Callers 1

evaluate_expressionFunction · 0.85

Calls 7

evaluate_expressionFunction · 0.85
add_opMethod · 0.45
sub_opMethod · 0.45
mul_opMethod · 0.45
div_opMethod · 0.45
rem_opMethod · 0.45
caret_opMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…