3
0

Fix broken tests

- TestStepAggregate
- TestQLWrapParsing

By fixing ast node parsing for more than 2 argument operators
This commit is contained in:
Vivek Patel
2023-01-26 15:49:51 +05:30
committed by Jože Fortun
parent aa45d94ec5
commit cc51a28b60
+6 -13
View File
@@ -319,16 +319,13 @@ func (nn parserNodes) ToAST() (out *ASTNode) {
// Have the op consume what it needs.
arg := auxArgs[bestOpIx]
if !isUnary(arg.Ref) {
for i, auxArg := range auxArgs {
if isOperator(auxArg.Ref) {
break
skip := 2
arg.Args = append(arg.Args, auxArgs[bestOpIx-1], auxArgs[bestOpIx+1])
if bestOpIx > -1 && len(auxArgs) > bestOpIx+2 {
if !isOperator(auxArgs[bestOpIx+2].Ref) {
skip = 3
arg.Args = append(arg.Args, auxArgs[bestOpIx+2])
}
if i == bestOpIx {
continue
}
arg.Args = append(arg.Args, auxArg)
}
// this is not needed anymore so we can remove it
@@ -338,10 +335,6 @@ func (nn parserNodes) ToAST() (out *ASTNode) {
aux := auxArgs[0 : bestOpIx-1]
aux = append(aux, arg)
// +X for right side, +1 because the left index is inclusive
skip := 2
if len(arg.Args) > 2 {
skip = len(arg.Args)
}
aux = append(aux, auxArgs[bestOpIx+skip:]...)
auxArgs = aux
} else {