util files moved form kern to util package

This commit is contained in:
2026-04-29 11:03:36 +02:00
parent 4d910dd069
commit 8787973de0
20 changed files with 284 additions and 250 deletions
+4 -3
View File
@@ -9,6 +9,7 @@ import (
"slices"
"git.portale-stac.it/go-pkg/expr/kern"
"git.portale-stac.it/go-pkg/expr/util"
// "strings"
)
@@ -61,8 +62,8 @@ func (ctx *SimpleStore) GetGlobal() (globalCtx kern.ExprContext) {
func (ctx *SimpleStore) Clone() kern.ExprContext {
clone := &SimpleStore{
global: ctx.global,
varStore: kern.CloneFilteredMap(ctx.varStore, filterRefName),
funcStore: kern.CloneFilteredMap(ctx.funcStore, filterRefName),
varStore: util.CloneFilteredMap(ctx.varStore, filterRefName),
funcStore: util.CloneFilteredMap(ctx.funcStore, filterRefName),
}
return clone
}
@@ -138,7 +139,7 @@ func (ctx *SimpleStore) UnsafeSetVar(varName string, value any) {
func (ctx *SimpleStore) SetVar(varName string, value any) {
// fmt.Printf("[%p] SetVar(%v, %v)\n", ctx, varName, value)
if allowedValue, ok := kern.FromGenericAny(value); ok {
if allowedValue, ok := util.FromGenericAny(value); ok {
ctx.varStore[varName] = allowedValue
} else {
panic(fmt.Errorf("unsupported type %T of value %v", value, value))