moved a subset of source file to the kern package
This commit is contained in:
+11
-7
@@ -4,6 +4,10 @@
|
||||
// operator-in.go
|
||||
package expr
|
||||
|
||||
import (
|
||||
"git.portale-stac.it/go-pkg/expr/kern"
|
||||
)
|
||||
|
||||
//-------- in term
|
||||
|
||||
func newInTerm(tk *Token) (inst *term) {
|
||||
@@ -21,19 +25,19 @@ func newInTerm(tk *Token) (inst *term) {
|
||||
// return
|
||||
// }
|
||||
|
||||
func evalIn(ctx ExprContext, opTerm *term) (v any, err error) {
|
||||
func evalIn(ctx kern.ExprContext, opTerm *term) (v any, err error) {
|
||||
var leftValue, rightValue any
|
||||
|
||||
if leftValue, rightValue, err = opTerm.evalInfix(ctx); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if IsList(rightValue) {
|
||||
list, _ := rightValue.(*ListType)
|
||||
v = list.indexDeepSameCmp(leftValue) >= 0
|
||||
} else if IsDict(rightValue) {
|
||||
dict, _ := rightValue.(*DictType)
|
||||
v = dict.hasKey(leftValue)
|
||||
if kern.IsList(rightValue) {
|
||||
list, _ := rightValue.(*kern.ListType)
|
||||
v = list.IndexDeepSameCmp(leftValue) >= 0
|
||||
} else if kern.IsDict(rightValue) {
|
||||
dict, _ := rightValue.(*kern.DictType)
|
||||
v = dict.HasKey(leftValue)
|
||||
} else {
|
||||
err = opTerm.errIncompatibleTypes(leftValue, rightValue)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user