operator-range.go: Fixed priority bug; when range only has the left limit, right limit is set to ConstLastIndex constant

This commit is contained in:
Celestino Amoroso 2024-06-19 09:20:02 +02:00
parent 302430d57d
commit 019470faf1

View File

@ -29,7 +29,7 @@ func newRangeTerm(tk *Token) (inst *term) {
tk: *tk,
children: make([]*term, 0, 2),
position: posInfix,
priority: priDot,
priority: priRange,
evalFunc: evalRange,
}
}
@ -47,7 +47,7 @@ func evalRange(ctx ExprContext, self *term) (v any, err error) {
if leftValue, err = self.children[0].compute(ctx); err != nil {
return
}
rightValue = int64(-1)
rightValue = int64(ConstLastIndex)
} else if leftValue, rightValue, err = self.evalInfix(ctx); err != nil {
return
}