moved a subset of source file to the kern package

This commit is contained in:
2026-04-27 19:43:37 +02:00
parent f100adead3
commit 4d910dd069
107 changed files with 2080 additions and 1380 deletions
+11 -7
View File
@@ -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)
}