Recursive expression tree evaluator */
| 2701 | |
| 2702 | /* Recursive expression tree evaluator */ |
| 2703 | static bool eval_expr(const cbm_expr_t *e, binding_t *b) { // NOLINT(misc-no-recursion) |
| 2704 | if (!e) { |
| 2705 | return true; |
| 2706 | } |
| 2707 | switch (e->type) { |
| 2708 | case EXPR_CONDITION: |
| 2709 | return eval_condition(&e->cond, b); |
| 2710 | case EXPR_AND: |
| 2711 | return (eval_expr(e->left, b) && eval_expr(e->right, b)) != 0; |
| 2712 | case EXPR_OR: |
| 2713 | return (eval_expr(e->left, b) || eval_expr(e->right, b)) != 0; |
| 2714 | case EXPR_NOT: |
| 2715 | return (!eval_expr(e->left, b)) != 0; |
| 2716 | case EXPR_XOR: |
| 2717 | return eval_expr(e->left, b) != eval_expr(e->right, b); |
| 2718 | } |
| 2719 | return true; |
| 2720 | } |
| 2721 | |
| 2722 | /* Evaluate WHERE clause — uses expression tree if available, falls back to legacy */ |
| 2723 | static bool eval_where(const cbm_where_clause_t *w, binding_t *b) { |
no test coverage detected