summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-12-29 13:12:42 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-12-29 13:12:42 -0800
commit2af0204512def6801b49faa432db351a7adaac6d (patch)
treeba46ad87f705c9922c5993d56462f3fc395a6045 /eval.c
parent744340ab8015179bd32d523e46ed2f56f20c82b9 (diff)
downloadtxr-2af0204512def6801b49faa432db351a7adaac6d.tar.gz
txr-2af0204512def6801b49faa432db351a7adaac6d.tar.bz2
txr-2af0204512def6801b49faa432db351a7adaac6d.zip
Bugfix: optarg presence indicators may be specials.
This fixes the incorrect treatment of the x-p parameter in (lambda (: (x form x-p))) when x-p is a special variable. It is being lexically bound. * eval.c (expand_opt_params_rec): When processing a (var initform) pair, check for (var initform sym). Error out if sym is not bindable. Check if it is special and if so, push it into the list of specials.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index fc3b928f..caac8d83 100644
--- a/eval.c
+++ b/eval.c
@@ -806,6 +806,13 @@ static val expand_opt_params_rec(val params, val menv,
not_bindable_error(form, sym);
if (special_var_p(sym))
push(sym, pspecials);
+ if (cddr(pair)) {
+ val opt_sym = caddr(pair);
+ if (!bindable(opt_sym))
+ not_bindable_error(form, opt_sym);
+ if (special_var_p(opt_sym))
+ push(opt_sym, pspecials);
+ }
return rlcp(cons(form_ex, expand_opt_params_rec(rest(params), menv,
form, pspecials)),
cdr(params));