Fix broken tests
- TestStepAggregate - TestQLWrapParsing By fixing ast node parsing for more than 2 argument operators
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user