summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/eval.c b/eval.c
index c4b6bcbb..1a83aff6 100644
--- a/eval.c
+++ b/eval.c
@@ -677,14 +677,16 @@ val apply(val fun, val arglist, val ctx_form)
for (; arglist && p < arg + APPLY_ARGS; arglist = cdr(arglist))
*p++ = car(arglist);
- if (arglist)
- eval_error(ctx_form, lit("~s: too many arguments"),
- ctx, nao);
+ nargs = p - arg;
- if ((nargs = p - arg) < reqargs)
+ if (nargs < reqargs)
eval_error(ctx_form, lit("~s: missing required arguments"),
ctx, nao);
+ if (nargs > fixparam)
+ eval_error(ctx_form, lit("~s: too many arguments"),
+ ctx, nao);
+
for (; nargs < fixparam; nargs++)
*p++ = colon_k;