Recursive expression tree evaluator */
| 2478 | |
| 2479 | /* Recursive expression tree evaluator */ |
| 2480 | static bool eval_expr(const cbm_expr_t *e, binding_t *b) { // NOLINT(misc-no-recursion) |
| 2481 | if (!e) { |
| 2482 | return true; |
| 2483 | } |
| 2484 | switch (e->type) { |
| 2485 | case EXPR_CONDITION: |
| 2486 | return eval_condition(&e->cond, b); |
| 2487 | case EXPR_AND: |
| 2488 | return (eval_expr(e->left, b) && eval_expr(e->right, b)) != 0; |
| 2489 | case EXPR_OR: |
| 2490 | return (eval_expr(e->left, b) || eval_expr(e->right, b)) != 0; |
| 2491 | case EXPR_NOT: |
| 2492 | return (!eval_expr(e->left, b)) != 0; |
| 2493 | case EXPR_XOR: |
| 2494 | return eval_expr(e->left, b) != eval_expr(e->right, b); |
| 2495 | } |
| 2496 | return true; |
| 2497 | } |
| 2498 | |
| 2499 | /* Evaluate WHERE clause — uses expression tree if available, falls back to legacy */ |
| 2500 | static bool eval_where(const cbm_where_clause_t *w, binding_t *b) { |
no test coverage detected