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) {
|
} else if isString(rightValue) {
|
||||||
s, _ := rightValue.(string)
|
s, _ := rightValue.(string)
|
||||||
v = len(s)
|
v = len(s)
|
||||||
// } else {
|
} else if it, ok := rightValue.(Iterator); ok {
|
||||||
// v = 1
|
v = it.Index()
|
||||||
// }
|
|
||||||
} else {
|
} else {
|
||||||
err = self.errIncompatibleType(rightValue)
|
err = self.errIncompatibleType(rightValue)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user