* Internal unified expression compiler that handles both namespaced and single-row evaluation
( expr: BasicExpression, isSingleRow: boolean, )
| 108 | * Internal unified expression compiler that handles both namespaced and single-row evaluation |
| 109 | */ |
| 110 | function compileExpressionInternal( |
| 111 | expr: BasicExpression, |
| 112 | isSingleRow: boolean, |
| 113 | ): (data: any) => any { |
| 114 | switch (expr.type) { |
| 115 | case `val`: { |
| 116 | // For constant values, return a function that just returns the value |
| 117 | const value = expr.value |
| 118 | return () => value |
| 119 | } |
| 120 | |
| 121 | case `ref`: { |
| 122 | // For references, compile based on evaluation mode |
| 123 | return isSingleRow ? compileSingleRowRef(expr) : compileRef(expr) |
| 124 | } |
| 125 | |
| 126 | case `func`: { |
| 127 | // For functions, use the unified compiler |
| 128 | return compileFunction(expr, isSingleRow) |
| 129 | } |
| 130 | |
| 131 | default: |
| 132 | throw new UnknownExpressionTypeError((expr as any).type) |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * Compiles a reference expression into an optimized evaluator |
no test coverage detected