summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-05-11 07:23:35 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-05-11 07:23:35 -0700
commit56d5ae7c0e8891355452cd29f3b0dede934c7d82 (patch)
treec03e612e9a5d11e6a7b20c05dff1d96465e75c43 /eval.c
parentc768f6ba6df0f944f457b1a82a5bbb3c85963110 (diff)
downloadtxr-56d5ae7c0e8891355452cd29f3b0dede934c7d82.tar.gz
txr-56d5ae7c0e8891355452cd29f3b0dede934c7d82.tar.bz2
txr-56d5ae7c0e8891355452cd29f3b0dede934c7d82.zip
Fix argument count checking regression.
* eval.c (apply): Revert some changes from 2015-03-13 which cause the too many arguments case not to be diagnosed.
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;