about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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);