adapted and enhanced the dict operations to make them compatible with the new DictType

This commit is contained in:
2024-05-19 01:38:07 +02:00
parent d6a1607041
commit 24a25bbf94
6 changed files with 111 additions and 20 deletions
+3 -2
View File
@@ -30,8 +30,9 @@ func evalLength(ctx ExprContext, self *term) (v any, err error) {
s, _ := childValue.(string)
v = int64(len(s))
} else if IsDict(childValue) {
m, _ := childValue.(map[any]any)
v = int64(len(m))
// m, _ := childValue.(map[any]any)
m, _ := childValue.(*DictType)
v = int64(len(*m))
} else if it, ok := childValue.(Iterator); ok {
if extIt, ok := childValue.(ExtIterator); ok && extIt.HasOperation(countName) {
count, _ := extIt.CallOperation(countName, nil)