summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-03-31 13:28:22 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-03-31 13:28:22 -0700
commitd934a3e1fc57f3efcdd772ae2822efc845e74468 (patch)
tree73c173043e2aacd33e407e5112c748f1281542fc
parent12bd2bfc9aaa72cb325428f898cf0cbdd4b6c8ab (diff)
downloadtxr-d934a3e1fc57f3efcdd772ae2822efc845e74468.tar.gz
txr-d934a3e1fc57f3efcdd772ae2822efc845e74468.tar.bz2
txr-d934a3e1fc57f3efcdd772ae2822efc845e74468.zip
expander: bugfix: fixed params visible to optionals.
* eval.c (expand_params_rec): Add the parameter to the macro-time environment before processing rest of parameter list. This is already done for all the symbols of a macro-style destructuring; just not for a simple parameter. This is necessary, because the init forms of optional parameters occur in a lexical environment in which prior parameters are visible. The test case for this is that (lambda (x : (y x))) must not produce a warning about unbound x.
-rw-r--r--eval.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index 399c61c4..6880a457 100644
--- a/eval.c
+++ b/eval.c
@@ -994,6 +994,7 @@ static val expand_params_rec(val params, val menv,
not_bindable_error(form, param);
} else {
param_ex = param;
+ new_menv = make_var_shadowing_env(menv, cons(param, nil));
}
{