summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-01-15 22:36:19 -0800
committerKaz Kylheku <kaz@kylheku.com>2017-01-15 22:36:19 -0800
commit69b5a0b4aac82baffabce1d884c77b5268d2777f (patch)
treea070f6536c1a95419e498db4cfc1da27ec0b99b0 /eval.c
parente634982247b4e212b261a9ad31ca8568ebd1be36 (diff)
downloadtxr-69b5a0b4aac82baffabce1d884c77b5268d2777f.tar.gz
txr-69b5a0b4aac82baffabce1d884c77b5268d2777f.tar.bz2
txr-69b5a0b4aac82baffabce1d884c77b5268d2777f.zip
Use tentative def mechanism for functions and vars.
* eval.c (do_expand): When walking a defun or defvarl, register them as tentative defs. Thus warnings are nicely supressed in code like (progn (defun foo ()) (foo)).
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index 0aea1d2f..cf66cc25 100644
--- a/eval.c
+++ b/eval.c
@@ -3866,6 +3866,9 @@ static val do_expand(val form, val menv)
if (!bindable(name))
not_bindable_error(form, name);
+ if (sym == defvarl_s)
+ uw_register_tentative_def(cons(var_s, name));
+
if (init != init_ex)
form_ex = rlcp(cons(sym, cons(name, cons(init_ex, nil))), form);
@@ -3902,6 +3905,9 @@ static val do_expand(val form, val menv)
builtin_reject_test(sym, name, form);
+ if (sym == defun_s)
+ uw_register_tentative_def(cons(fun_s, name));
+
{
val inter_env = make_var_shadowing_env(menv, get_param_syms(params));
val new_menv = if3(sym == defun_s,