From d7d25bb0b3fd4e07fb3ebcfa4f04463c88f7d813 Mon Sep 17 00:00:00 2001 From: Tim Voronov Date: Sat, 26 Jul 2025 10:15:43 -0400 Subject: [PATCH] Refactor `ExprCompiler` to use variable name for symbol resolution and update integration tests by replacing `SkipCaseArray` and `DebugCaseArray` with `CaseArray` for consistency. --- pkg/compiler/internal/expr.go | 5 +++-- test/integration/vm/vm_for_in_collect_agg_test.go | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pkg/compiler/internal/expr.go b/pkg/compiler/internal/expr.go index a17440e9..e78ca12c 100644 --- a/pkg/compiler/internal/expr.go +++ b/pkg/compiler/internal/expr.go @@ -364,11 +364,12 @@ func (ec *ExprCompiler) CompileMemberExpression(ctx fql.IMemberExpressionContext } func (ec *ExprCompiler) CompileVariable(ctx fql.IVariableContext) vm.Operand { + name := ctx.Identifier().GetText() // Just return the register / constant index - op, _, found := ec.ctx.Symbols.Resolve(ctx.GetText()) + op, _, found := ec.ctx.Symbols.Resolve(name) if !found { - panic(runtime.Error(core.ErrVariableNotFound, ctx.GetText())) + panic(runtime.Error(core.ErrVariableNotFound, name)) } if op.IsRegister() { diff --git a/test/integration/vm/vm_for_in_collect_agg_test.go b/test/integration/vm/vm_for_in_collect_agg_test.go index 1ab6d88f..33109af3 100644 --- a/test/integration/vm/vm_for_in_collect_agg_test.go +++ b/test/integration/vm/vm_for_in_collect_agg_test.go @@ -205,7 +205,7 @@ FOR u IN users "highSalaryCount": 3, }, }, "Should aggregate with conditional expressions"), - SkipCaseArray(` + CaseArray(` LET users = [ { active: true, @@ -247,7 +247,7 @@ FOR u IN users `, []any{map[string]any{"minAge": 25, "maxAge": 69}}, "Should collect and aggregate values without grouping"), - SkipCaseArray(` + CaseArray(` LET users = [] FOR u IN users COLLECT AGGREGATE minAge = MIN(u.age), maxAge = MAX(u.age) @@ -258,7 +258,7 @@ FOR u IN users `, []any{map[string]any{"minAge": nil, "maxAge": nil}}, "Should handle empty arrays gracefully"), - DebugCaseArray(` + CaseArray(` LET users = [ { active: true,