operator length # supports linked-list
This commit is contained in:
@@ -37,6 +37,8 @@ func evalLength(ctx kern.ExprContext, opTerm *scan.Term) (v any, err error) {
|
|||||||
} else if kern.IsDict(childValue) {
|
} else if kern.IsDict(childValue) {
|
||||||
m, _ := childValue.(*kern.DictType)
|
m, _ := childValue.(*kern.DictType)
|
||||||
v = int64(len(*m))
|
v = int64(len(*m))
|
||||||
|
} else if lls, ok := childValue.(*kern.LinkedList); ok {
|
||||||
|
v = int64(lls.Len())
|
||||||
} else if it, ok := childValue.(kern.Iterator); ok {
|
} else if it, ok := childValue.(kern.Iterator); ok {
|
||||||
v = int64(it.Count())
|
v = int64(it.Count())
|
||||||
// if extIt, ok := childValue.(ExtIterator); ok && extIt.HasOperation(CountName) {
|
// if extIt, ok := childValue.(ExtIterator); ok && extIt.HasOperation(CountName) {
|
||||||
|
|||||||
Reference in New Issue
Block a user