diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-11-27 09:05:15 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-11-27 09:05:15 -0800 |
commit | 606132c336dbeb0dd8bb851a64c97f2c11b76a85 (patch) | |
tree | e4747eb85f1ce738601773a4dcd5ed4e4d333335 /eval.c | |
parent | 6cfa2b9042108366d248a5537dfb03802cafdad1 (diff) | |
download | txr-606132c336dbeb0dd8bb851a64c97f2c11b76a85.tar.gz txr-606132c336dbeb0dd8bb851a64c97f2c11b76a85.tar.bz2 txr-606132c336dbeb0dd8bb851a64c97f2c11b76a85.zip |
bugfix: var environment in expansion of defun.
* eval.c (do_expand): When expanding the body of a defun
we must create a function shadowing environment which
indicates that the function's name is in scope.
This must not be done for defmacro; a defmacro doesn't
introduce a function binding, and a macros's body doesn't
have that macro in scope.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -3726,7 +3726,10 @@ static val do_expand(val form, val menv) check_lambda_list(form, sym, params); { - val new_menv = make_var_shadowing_env(menv, get_param_syms(params)); + val inter_env = make_var_shadowing_env(menv, get_param_syms(params)); + val new_menv = if3(sym == defun_s, + make_fun_shadowing_env(inter_env, cons(name, nil)), + inter_env); val params_ex = expand_params(params, menv); val body = rest(rest(rest(form))); val body_ex = expand_progn(body, new_menv); |