operator-length.go: the prefix operator '#' now accept iterator oeprand; it returns the index of the current item
This commit is contained in:
parent
a22047e84e
commit
107ec4958f
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user