From a2a9bacd8296ed1ddb6105b649a062fe65c27759 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 1 Nov 2003 19:10:19 +0000 Subject: [PATCH] * Filter the substitution list when descending into a recursive attribute set. --- src/fix-ng/fix-expr.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/fix-ng/fix-expr.cc b/src/fix-ng/fix-expr.cc index ff0b7d43d..96cb13b72 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([])", &bindings)) { + Subs subs2(subs); + ATermList bnds = bindings; + while (!ATisEmpty(bnds)) { + Expr e; + if (!ATmatch(ATgetFirst(bnds), "Bind(, )", &s, &e)) + abort(); /* can't happen */ + subs2.erase(s); + bnds = ATgetNext(bnds); + } + return ATmake("Rec()", substitute(subs2, (ATerm) bindings)); + } if (ATgetType(e) == AT_APPL) { AFun fun = ATgetAFun(e);