summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-11-27 09:14:01 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-11-27 09:14:01 -0800
commit4016b57938b5d1491e41625eae67c4ed2d66193e (patch)
tree1ea37b67572bd3ff400dd72752b83b4920ab02c3 /eval.c
parent606132c336dbeb0dd8bb851a64c97f2c11b76a85 (diff)
downloadtxr-4016b57938b5d1491e41625eae67c4ed2d66193e.tar.gz
txr-4016b57938b5d1491e41625eae67c4ed2d66193e.tar.bz2
txr-4016b57938b5d1491e41625eae67c4ed2d66193e.zip
Warn about unbound functions.
* eval.c (do_expand): If a compound form doesn't expand into anything, then let us check whether it calls an unbound function, and issue a warning. * share/txr/stdlib/place.tl (sys:pl-expand): Move function definition ahead of first use to suppress unbound function warning. Eventually we will have a relaxed model of deferred warning about this. (sys:placelet-1): Suppress warnings around call to sys:expand because we are expanding a body into which we inserted function calls without inserting their definitions.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index c15ef1c5..8b56cbda 100644
--- a/eval.c
+++ b/eval.c
@@ -3898,8 +3898,11 @@ static val do_expand(val form, val menv)
val args = rest(form_ex);
val args_ex = expand_forms(args, menv);
- if (form_ex == form && args_ex == args)
+ if (form_ex == form && args_ex == args) {
+ if (!lookup_fun(menv, sym) && !special_operator_p(sym))
+ eval_warn(last_form_expanded, lit("unbound function ~s"), sym, nao);
return form;
+ }
if (args_ex == args)
return form_ex;