summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-05-12 00:01:57 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-05-12 00:01:57 -0700
commit1162a735b61c1c5086fb6055471ee35cc8ed62a4 (patch)
tree77dc3b091d2e50f0a6115182a00c2da9d281c1f9 /eval.c
parent72ea47cb951a774318ab045cf342882cad3ff55d (diff)
downloadtxr-1162a735b61c1c5086fb6055471ee35cc8ed62a4.tar.gz
txr-1162a735b61c1c5086fb6055471ee35cc8ed62a4.tar.bz2
txr-1162a735b61c1c5086fb6055471ee35cc8ed62a4.zip
expander: new rule for macro-produced function calls
* eval.c (do_expand): When a function call's arguments are expanded and produce a transformation, then if that function call had been produced by a macro, the transformed function call is tried again as a macro. This is necessary because TXR Lisp allows a symbol to be both a function and macro. When a macro-produced function call's arguments are expanded, the macro version of that function may, as a result of the argument transformations, have more opportunities for expansion. * txr.1: New section outlining how macro expansion generally works, with a special focus on this unusual new rule.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index f6268344..b8a611d2 100644
--- a/eval.c
+++ b/eval.c
@@ -5255,7 +5255,12 @@ again:
return form_ex;
}
- return rlcp(cons(insym_ex, args_ex), form);
+ form = rlcp(cons(insym_ex, args_ex), form);
+ if (macro) {
+ macro = nil;
+ goto again;
+ }
+ return form;
}
abort();
}