Since now builtin functions are registared in a new global context. This reduces the effort to copy the whole set of builtin functions in the context of a function call; only the called function will be copied, if it is global.
This commit is contained in:
+2
-2
@@ -24,8 +24,8 @@ func newVarTerm(tk *Token) *term {
|
||||
func evalVar(ctx ExprContext, self *term) (v any, err error) {
|
||||
var exists bool
|
||||
name := self.source()
|
||||
if v, exists = ctx.GetVar(name); !exists {
|
||||
if info, exists := ctx.GetFuncInfo(name); exists {
|
||||
if v, exists = GetVar(ctx, name); !exists {
|
||||
if info, exists, _ := GetFuncInfo(ctx, name); exists {
|
||||
v = info.Functor()
|
||||
} else {
|
||||
err = fmt.Errorf("undefined variable or function %q", name)
|
||||
|
||||
Reference in New Issue
Block a user