summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-04-08 09:44:28 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-04-08 09:44:28 -0700
commit2a08c9d9773e8dddc35fe102c6a6f8f853090596 (patch)
tree7aa5bf2c3d502b66646c605534b27d9ee5ad60ec /eval.c
parent973521df42d9602bedd487d7b137d8698916a1d9 (diff)
downloadtxr-2a08c9d9773e8dddc35fe102c6a6f8f853090596.tar.gz
txr-2a08c9d9773e8dddc35fe102c6a6f8f853090596.tar.bz2
txr-2a08c9d9773e8dddc35fe102c6a6f8f853090596.zip
expander: consolidate dotted argument error.
* eval.c (dotted_form_error): New static function. (expand_forms, expand_forms_ss, expand_forms_lisp1): Call dotted_form_error instead of repeated open coded uw_throwf calls.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/eval.c b/eval.c
index 72a5f973..e893aea6 100644
--- a/eval.c
+++ b/eval.c
@@ -3096,13 +3096,18 @@ static val dot_to_apply(val form, val lisp1_p)
return form;
}
+noreturn static void dotted_form_error(val form)
+{
+ uw_throwf(error_s, lit("dotted argument ~!~s not supported by form"),
+ form, nao);
+}
+
val expand_forms(val form, val menv)
{
if (atom(form)) {
if (!form || (opt_compat && opt_compat <= 137))
return form;
- uw_throwf(error_s, lit("dotted argument ~!~s "
- "was not converted to apply form"), form, nao);
+ dotted_form_error(form);
} else {
val f = car(form);
val r = cdr(form);
@@ -3123,8 +3128,7 @@ static val expand_forms_ss(val form, val menv, val ss_hash)
if (atom(form)) {
if (!form)
return form;
- uw_throwf(error_s, lit("dotted argument ~!~s "
- "was not converted to apply form"), form, nao);
+ dotted_form_error(form);
} else {
val f = car(form);
val r = cdr(form);
@@ -3209,8 +3213,7 @@ static val expand_forms_lisp1(val form, val menv)
if (atom(form)) {
if (!form || (opt_compat && opt_compat <= 137))
return form;
- uw_throwf(error_s, lit("dotted function call ~!~s "
- "was not converted to apply form"), form, nao);
+ dotted_form_error(form);
} else {
val f = car(form);
val r = cdr(form);