diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-03-30 12:55:29 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-03-30 12:55:29 -0700 |
commit | 492ce0c58f2b51a671e04febf1ac39a25b8d83de (patch) | |
tree | 6d41e045166a466c8f12a8bc72bcbdec9c8c3337 | |
parent | 1e2b08641c9cf07f3c74f8d1561f8fd52bf92545 (diff) | |
download | txr-492ce0c58f2b51a671e04febf1ac39a25b8d83de.tar.gz txr-492ce0c58f2b51a671e04febf1ac39a25b8d83de.tar.bz2 txr-492ce0c58f2b51a671e04febf1ac39a25b8d83de.zip |
eval: add missing checks in fun operator.
* eval.c (do_expand): When traversing (fun ...)
operator, warn if the function isn't defined or if it is being
applied to a special operator.
-rw-r--r-- | eval.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -4470,6 +4470,19 @@ again: val arg_ex = expand(arg, menv); return rlcp(list(sym, arg_ex, nao), form); } + if (!lookup_fun(menv, arg)) { + if (special_operator_p(arg)) + eval_warn(last_form_expanded, + lit("fun used on special operator ~s"), arg, nao); + else if (!bindable(arg)) + eval_warn(last_form_expanded, + lit("~s appears in operator position"), arg, nao); + else + eval_defr_warn(last_form_expanded, + cons(fun_s, arg), + lit("unbound function ~s"), + arg, nao); + } return form; } else if (sym == quote_s || sym == dvbind_s) { return form; |