MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / _AR_EXP_Evaluate

Function _AR_EXP_Evaluate

src/arithmetic/arithmetic_expression.c:592–624  ·  view source on GitHub ↗

evaluate an expression tree, placing the calculated value in 'result' and returning whether an error occurred during evaluation

Source from the content-addressed store, hash-verified

590// placing the calculated value in 'result'
591// and returning whether an error occurred during evaluation
592static AR_EXP_Result _AR_EXP_Evaluate
593(
594 AR_ExpNode *root,
595 const Record r,
596 SIValue *result
597) {
598 AR_EXP_Result res = EVAL_OK;
599
600 switch(root->type) {
601 case AR_EXP_OP:
602 return _AR_EXP_EvaluateFunctionCall(root, r, result);
603 case AR_EXP_OPERAND:
604 switch(root->operand.type) {
605 case AR_EXP_CONSTANT:
606 // the value is constant or has been computed elsewhere
607 // share with caller
608 *result = SI_ShareValue(root->operand.constant);
609 return res;
610 case AR_EXP_VARIADIC:
611 return _AR_EXP_EvaluateVariadic(root, r, result);
612 case AR_EXP_PARAM:
613 return _AR_EXP_EvaluateParam(root, result);
614 case AR_EXP_BORROW_RECORD:
615 return _AR_EXP_EvaluateBorrowRecord(root, r, result);
616 default:
617 ASSERT(false && "Invalid expression type");
618 }
619 default:
620 ASSERT(false && "Unknown expression type");
621 }
622
623 return res;
624}
625
626SIValue AR_EXP_Evaluate_NoThrow(AR_ExpNode *root, const Record r) {
627 SIValue result;

Callers 3

AR_EXP_Evaluate_NoThrowFunction · 0.85
AR_EXP_EvaluateFunction · 0.85

Calls 5

SI_ShareValueFunction · 0.85
_AR_EXP_EvaluateVariadicFunction · 0.85
_AR_EXP_EvaluateParamFunction · 0.85

Tested by

no test coverage detected