evaluate an expression tree, placing the calculated value in 'result' and returning whether an error occurred during evaluation
| 590 | // placing the calculated value in 'result' |
| 591 | // and returning whether an error occurred during evaluation |
| 592 | static 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 | |
| 626 | SIValue AR_EXP_Evaluate_NoThrow(AR_ExpNode *root, const Record r) { |
| 627 | SIValue result; |
no test coverage detected