about summary refs log tree commit diff
path: root/src/fix-ng/fix-expr.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-11-01T19·10+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-11-01T19·10+0000
commita2a9bacd8296ed1ddb6105b649a062fe65c27759 (patch)
tree2281e7354877c533a8656f6ca33335c8c60e58ef /src/fix-ng/fix-expr.cc
parent449411e5113084da323d265f1b1313d9a5ca64aa (diff)
* Filter the substitution list when descending into a recursive
  attribute set.

Diffstat (limited to 'src/fix-ng/fix-expr.cc')
-rw-r--r--src/fix-ng/fix-expr.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/fix-ng/fix-expr.cc b/src/fix-ng/fix-expr.cc
index ff0b7d43d061..96cb13b725e5 100644
--- a/src/fix-ng/fix-expr.cc
+++ b/src/fix-ng/fix-expr.cc
@@ -97,7 +97,20 @@ ATerm substitute(Subs & subs, ATerm e)
             substitute(subs2, body));
     }
 
-    /* !!! Rec(...) */
+    /* Idem for a mutually recursive attribute set. */
+    ATermList bindings;
+    if (ATmatch(e, "Rec([<list>])", &bindings)) {
+        Subs subs2(subs);
+        ATermList bnds = bindings;
+        while (!ATisEmpty(bnds)) {
+            Expr e;
+            if (!ATmatch(ATgetFirst(bnds), "Bind(<str>, <term>)", &s, &e))
+                abort(); /* can't happen */
+            subs2.erase(s);
+            bnds = ATgetNext(bnds);
+        }
+        return ATmake("Rec(<term>)", substitute(subs2, (ATerm) bindings));
+    }
 
     if (ATgetType(e) == AT_APPL) {
         AFun fun = ATgetAFun(e);