New interface and implementation to model function parameters
This commit is contained in:
+6
-2
@@ -31,7 +31,8 @@ func checkFunctionCall(ctx ExprContext, name string, params []any) (err error) {
|
||||
err = errTooMuchParams(info.MaxArgs(), len(params))
|
||||
}
|
||||
if err == nil && owner != ctx {
|
||||
ctx.RegisterFunc(name, info.Functor(), info.MinArgs(), info.MaxArgs())
|
||||
// ctx.RegisterFunc(name, info.Functor(), info.MinArgs(), info.MaxArgs())
|
||||
ctx.RegisterFuncInfo(info)
|
||||
}
|
||||
} else {
|
||||
err = fmt.Errorf("unknown function %s()", name)
|
||||
@@ -85,7 +86,10 @@ func (functor *funcDefFunctor) Invoke(ctx ExprContext, name string, args []any)
|
||||
if i < len(args) {
|
||||
arg := args[i]
|
||||
if functor, ok := arg.(Functor); ok {
|
||||
ctx.RegisterFunc(p, functor, 0, -1)
|
||||
// ctx.RegisterFunc(p, functor, 0, -1)
|
||||
ctx.RegisterFunc2(p, functor, typeAny, []ExprFuncParam{
|
||||
newFuncParam(paramValue),
|
||||
})
|
||||
} else {
|
||||
ctx.UnsafeSetVar(p, arg)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user