expressions now support dict data-type
This commit is contained in:
+8
-2
@@ -23,8 +23,14 @@ func newVarTerm(tk *Token) *term {
|
||||
// -------- eval func
|
||||
func evalVar(ctx ExprContext, self *term) (v any, err error) {
|
||||
var exists bool
|
||||
if v, exists = ctx.GetVar(self.tk.source); !exists {
|
||||
err = fmt.Errorf("undefined variable %q", self.tk.source)
|
||||
name := self.source()
|
||||
if v, exists = ctx.GetVar(name); !exists {
|
||||
info := ctx.GetFuncInfo(name)
|
||||
if info != nil {
|
||||
v = info.Functor()
|
||||
} else {
|
||||
err = fmt.Errorf("undefined variable or function %q", name)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user