Skip to content
Snippets Groups Projects
Commit a2a9bacd authored by Eelco Dolstra's avatar Eelco Dolstra
Browse files

* Filter the substitution list when descending into a recursive

  attribute set.
parent 449411e5
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment