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
+9 -5
View File
@@ -4,7 +4,11 @@
// operand-var.go
package expr
import "fmt"
import (
"fmt"
"git.portale-stac.it/go-pkg/expr/kern"
)
// -------- variable term
func newVarTerm(tk *Token) *term {
@@ -21,11 +25,11 @@ func newVarTerm(tk *Token) *term {
}
// -------- eval func
func evalVar(ctx ExprContext, opTerm *term) (v any, err error) {
func evalVar(ctx kern.ExprContext, opTerm *term) (v any, err error) {
var exists bool
name := opTerm.source()
if v, exists = GetVar(ctx, name); !exists {
if info, exists := GetFuncInfo(ctx, name); exists {
name := opTerm.Source()
if v, exists = ctx.GetVar(name); !exists {
if info, exists := ctx.GetFuncInfo(name); exists {
v = info.Functor()
} else {
err = fmt.Errorf("undefined variable or function %q", name)