adapted to the new GetFuncInfo() specification
This commit is contained in:
parent
761ec868e6
commit
d354102c6a
@ -11,9 +11,7 @@ import (
|
||||
// -------- function call term
|
||||
func newFuncCallTerm(tk *Token, args []*term) *term {
|
||||
return &term{
|
||||
tk: *tk,
|
||||
// class: classVar,
|
||||
// kind: kindUnknown,
|
||||
tk: *tk,
|
||||
parent: nil,
|
||||
children: args,
|
||||
position: posLeaf,
|
||||
@ -44,7 +42,7 @@ func evalFuncCall(parentCtx ExprContext, self *term) (v any, err error) {
|
||||
}
|
||||
// Export functions
|
||||
for _, refName := range ctx.EnumFuncs(func(name string) bool { return exportAll || name[0] == '@' }) {
|
||||
if info := ctx.GetFuncInfo(refName); info != nil {
|
||||
if info, _ := ctx.GetFuncInfo(refName); info != nil {
|
||||
exportFunc(parentCtx, refName, info)
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,7 @@ func evalVar(ctx ExprContext, self *term) (v any, err error) {
|
||||
var exists bool
|
||||
name := self.source()
|
||||
if v, exists = ctx.GetVar(name); !exists {
|
||||
info := ctx.GetFuncInfo(name)
|
||||
if info != nil {
|
||||
if info, exists := ctx.GetFuncInfo(name); exists {
|
||||
v = info.Functor()
|
||||
} else {
|
||||
err = fmt.Errorf("undefined variable or function %q", name)
|
||||
|
@ -50,8 +50,8 @@ func (ctx *SimpleFuncStore) Clone() ExprContext {
|
||||
}
|
||||
}
|
||||
|
||||
func (ctx *SimpleFuncStore) GetFuncInfo(name string) (info ExprFunc) {
|
||||
info, _ = ctx.funcStore[name]
|
||||
func (ctx *SimpleFuncStore) GetFuncInfo(name string) (info ExprFunc, exists bool) {
|
||||
info, exists = ctx.funcStore[name]
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ func (ctx *SimpleVarStore) EnumVars(acceptor func(name string) (accept bool)) (v
|
||||
return
|
||||
}
|
||||
|
||||
func (ctx *SimpleVarStore) GetFuncInfo(name string) (f ExprFunc) {
|
||||
func (ctx *SimpleVarStore) GetFuncInfo(name string) (f ExprFunc, exists bool) {
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user