operator-length.go: the prefix operator '#' now accept iterator oeprand; it returns the index of the current item

This commit is contained in:
Celestino Amoroso 2024-04-26 08:04:55 +02:00
parent a22047e84e
commit 107ec4958f

View File

@ -29,9 +29,8 @@ func evalLength(ctx ExprContext, self *term) (v any, err error) {
} else if isString(rightValue) {
s, _ := rightValue.(string)
v = len(s)
// } else {
// v = 1
// }
} else if it, ok := rightValue.(Iterator); ok {
v = it.Index()
} else {
err = self.errIncompatibleType(rightValue)
}