diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-11-27 09:14:01 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-11-27 09:14:01 -0800 |
commit | 4016b57938b5d1491e41625eae67c4ed2d66193e (patch) | |
tree | 1ea37b67572bd3ff400dd72752b83b4920ab02c3 /eval.c | |
parent | 606132c336dbeb0dd8bb851a64c97f2c11b76a85 (diff) | |
download | txr-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.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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; |