list iterators now support start, stop e step

This commit is contained in:
2024-05-04 08:07:49 +02:00
parent d9fbe6f36d
commit 2c5f02cc69
9 changed files with 115 additions and 37 deletions
+6 -1
View File
@@ -30,7 +30,12 @@ func evalLength(ctx ExprContext, self *term) (v any, err error) {
s, _ := childValue.(string)
v = int64(len(s))
} else if it, ok := childValue.(Iterator); ok {
v = int64(it.Index() + 1)
if extIt, ok := childValue.(ExtIterator); ok && extIt.HasOperation(countName) {
count, _ := extIt.CallOperation(countName, nil)
v, _ = toInt(count, "")
} else {
v = int64(it.Index() + 1)
}
} else {
err = self.errIncompatibleType(childValue)
}