moved a subset of source file to the kern package
This commit is contained in:
+9
-5
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user