summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-03-26 21:43:18 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-03-26 21:43:18 -0700
commit6597ea5e7359f3936d6e73cccc142cd107e17a9f (patch)
treeac2c5ca13a32878b876621ac740345795f2bee4a
parente96cb9e2065a066ede10e3ce36eba828fd42a97b (diff)
downloadtxr-6597ea5e7359f3936d6e73cccc142cd107e17a9f.tar.gz
txr-6597ea5e7359f3936d6e73cccc142cd107e17a9f.tar.bz2
txr-6597ea5e7359f3936d6e73cccc142cd107e17a9f.zip
Bugfix in error location reporting across macro expansions.
* eval.c (do_expand, macroexpand_1): The original form must have priority in providing source location info, over the macro. Otherwise macro bodies may get reported as locations of errors that occur in substituted code.
-rw-r--r--eval.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index f976673b..51530dcc 100644
--- a/eval.c
+++ b/eval.c
@@ -3518,7 +3518,7 @@ tail:
val mac_expand = expand_macro(form, macro, menv);
if (mac_expand == form)
return form;
- form = rlcp_tree(rlcp_tree(mac_expand, macro), form);
+ form = rlcp_tree(rlcp_tree(mac_expand, form), macro);
goto tail;
} else if (sym == progn_s) {
val args = rest(form);
@@ -3587,7 +3587,7 @@ static val macroexpand_1(val form, val menv)
val mac_expand = expand_macro(form, macro, menv);
if (mac_expand == form)
return form;
- return rlcp_tree(rlcp_tree(mac_expand, macro), form);
+ return rlcp_tree(rlcp_tree(mac_expand, form), macro);
}
if (bindable(form) && (macro = lookup_symac(menv, form))) {