the function call procedure now check the number of actual parameters against the numer of formal parameters
This commit is contained in:
+8
-1
@@ -29,7 +29,14 @@ func evalAssign(ctx ExprContext, self *term) (v any, err error) {
|
||||
|
||||
if v, err = self.children[1].compute(ctx); err == nil {
|
||||
if functor, ok := v.(Functor); ok {
|
||||
ctx.RegisterFunc(leftTerm.source(), functor, 0, -1)
|
||||
var minArgs, maxArgs int = 0, 0
|
||||
|
||||
if funcDef, ok := functor.(*funcDefFunctor); ok {
|
||||
l := len(funcDef.params)
|
||||
minArgs = l
|
||||
maxArgs = l
|
||||
}
|
||||
ctx.RegisterFunc(leftTerm.source(), functor, minArgs, maxArgs)
|
||||
} else {
|
||||
ctx.setVar(leftTerm.source(), v)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user