linked-list: sum and in operators
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"git.portale-stac.it/go-pkg/expr/scan"
|
||||
"git.portale-stac.it/go-pkg/expr/types/array"
|
||||
"git.portale-stac.it/go-pkg/expr/types/dict"
|
||||
"git.portale-stac.it/go-pkg/expr/types/list"
|
||||
)
|
||||
|
||||
//-------- in term
|
||||
@@ -41,6 +42,9 @@ func evalIn(ctx kern.ExprContext, opTerm *scan.Term) (v any, err error) {
|
||||
} else if dict.IsDict(rightValue) {
|
||||
dict, _ := rightValue.(*dict.DictType)
|
||||
v = dict.HasKey(leftValue)
|
||||
} else if list.IsLinkedList(rightValue) {
|
||||
ls, _ := rightValue.(*list.LinkedList)
|
||||
v = ls.HasValue(leftValue)
|
||||
} else {
|
||||
err = opTerm.ErrIncompatibleTypes(leftValue, rightValue)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user