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