diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-05-11 07:23:35 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-05-11 07:23:35 -0700 |
commit | 56d5ae7c0e8891355452cd29f3b0dede934c7d82 (patch) | |
tree | c03e612e9a5d11e6a7b20c05dff1d96465e75c43 /eval.c | |
parent | c768f6ba6df0f944f457b1a82a5bbb3c85963110 (diff) | |
download | txr-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.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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; |