1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-08-13 19:52:52 +02:00

Refactor ExprCompiler to use variable name for symbol resolution and update integration tests by replacing SkipCaseArray and DebugCaseArray with CaseArray for consistency.

This commit is contained in:
Tim Voronov
2025-07-26 10:15:43 -04:00
parent 8aa36442e9
commit d7d25bb0b3
2 changed files with 6 additions and 5 deletions

View File

@@ -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() {

View File

@@ -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,