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 | 960d5e602c3074afea907b35686482393ada6255 (patch) | |
tree | 6d41e045166a466c8f12a8bc72bcbdec9c8c3337 | |
parent | fdf176960fee2f2ee2e20c92d1b2d1e3363cf5ce (diff) | |
download | txr-960d5e602c3074afea907b35686482393ada6255.tar.gz txr-960d5e602c3074afea907b35686482393ada6255.tar.bz2 txr-960d5e602c3074afea907b35686482393ada6255.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; |