diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-01-23 18:19:52 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-01-23 18:19:52 -0800 |
commit | 75abded71ecaf0f5d1d3257f436b2df9690bdc25 (patch) | |
tree | b385b76d7e0a2396bc454483fa059e470576948a | |
parent | a28cb225ab66060a46eee6776fe9e735944d0e96 (diff) | |
download | txr-75abded71ecaf0f5d1d3257f436b2df9690bdc25.tar.gz txr-75abded71ecaf0f5d1d3257f436b2df9690bdc25.tar.bz2 txr-75abded71ecaf0f5d1d3257f436b2df9690bdc25.zip |
places: fix runaway recursion bug.
The following form fails to expand:
(let (a) (set a '#1=(#1#)))
This is due to macro ancestor propagation which wants to
traverse the entire (set ...) form in order to indicate its
macro ancestor.
* share/txr/stdlib/place.tl (sys:propagate-ancestor): We check
whether to-tree already has a macro ancestor, and only recurse
if it doesn't.
-rw-r--r-- | share/txr/stdlib/place.tl | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/share/txr/stdlib/place.tl b/share/txr/stdlib/place.tl index ac403ccb..3ee0ea8c 100644 --- a/share/txr/stdlib/place.tl +++ b/share/txr/stdlib/place.tl @@ -135,12 +135,13 @@ ^(let ,(zip syms (repeat '((gensym)))) ,*body)) (defun sys:propagate-ancestor (to-tree from-form . syms) - (tree-case to-tree - ((a . d) - (when (memq a syms) - (sys:set-macro-ancestor to-tree from-form)) - (sys:propagate-ancestor a from-form . syms) - (sys:propagate-ancestor d from-form . syms))) + (unless (macro-ancestor to-tree) + (tree-case to-tree + ((a . d) + (when (memq a syms) + (sys:set-macro-ancestor to-tree from-form)) + (sys:propagate-ancestor a from-form . syms) + (sys:propagate-ancestor d from-form . syms)))) to-tree) (defun call-update-expander (getter setter unex-place env body) |