Skip to content

Commit

Permalink
Fixes #69 - evaluate rhs after string slices
Browse files Browse the repository at this point in the history
Signed-off-by: Springcomp <[email protected]>
  • Loading branch information
springcomp committed Oct 27, 2024
1 parent 6eb5a34 commit 8dcafac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compliance
Submodule compliance updated 3 files
+139 −0 README.md
+0 −134 README.rst
+12 −0 tests/slice.json
8 changes: 7 additions & 1 deletion pkg/interpreter/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,13 @@ func (intr *treeInterpreter) execute(node parsing.ASTNode, value any, functionCa
}
stringType, ok := left.(string)
if allowString && ok {
return stringType, nil
// a projection is really a sub-expression in disguise
// we must evaluate the right hand expression
result, err := intr.Execute(node.Children[1], stringType)
if err != nil {
return nil, err
}
return result, nil
}
return nil, nil
}
Expand Down

0 comments on commit 8dcafac

Please sign in to comment.