enabled passing functions as parameters in function call
This commit is contained in:
+6
-1
@@ -89,7 +89,12 @@ type funcDefFunctor struct {
|
||||
func (functor *funcDefFunctor) Invoke(ctx ExprContext, name string, args []any) (result any, err error) {
|
||||
for i, p := range functor.params {
|
||||
if i < len(args) {
|
||||
ctx.setVar(p, args[i])
|
||||
arg := args[i]
|
||||
if functor, ok := arg.(Functor); ok {
|
||||
ctx.RegisterFunc(p, functor, 0, -1)
|
||||
} else {
|
||||
ctx.setVar(p, arg)
|
||||
}
|
||||
} else {
|
||||
ctx.setVar(p, nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user