diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-01T19·10+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-01T19·10+0000 |
commit | a2a9bacd8296ed1ddb6105b649a062fe65c27759 (patch) | |
tree | 2281e7354877c533a8656f6ca33335c8c60e58ef /src | |
parent | 449411e5113084da323d265f1b1313d9a5ca64aa (diff) |
* Filter the substitution list when descending into a recursive
attribute set.
Diffstat (limited to 'src')
-rw-r--r-- | src/fix-ng/fix-expr.cc | 15 |
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); |