Merge r20344 & r20346.
This commit is contained in:
parent
2fb0df83e9
commit
741b7577c1
|
@ -147,6 +147,7 @@ while (<STDIN>) {
|
||||||
print HEADER "extern ATerm $name;\n";
|
print HEADER "extern ATerm $name;\n";
|
||||||
print IMPL "ATerm $name = 0;\n";
|
print IMPL "ATerm $name = 0;\n";
|
||||||
$init .= " $name = $value;\n";
|
$init .= " $name = $value;\n";
|
||||||
|
$init .= " ATprotect(&$name);\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
elsif (/^\s*init\s+(\w+)\s*$/) {
|
elsif (/^\s*init\s+(\w+)\s*$/) {
|
||||||
|
|
|
@ -85,6 +85,10 @@ static Expr fixAttrs(bool recursive, ATermList as)
|
||||||
{
|
{
|
||||||
Tree attrs;
|
Tree attrs;
|
||||||
|
|
||||||
|
/* This ATermMap is needed to ensure that the `leaf' fields in the
|
||||||
|
Tree nodes are not garbage collected. */
|
||||||
|
ATermMap gcRoots;
|
||||||
|
|
||||||
for (ATermIterator i(as); i; ++i) {
|
for (ATermIterator i(as); i; ++i) {
|
||||||
ATermList names, attrPath; Expr src, e; ATerm name, pos;
|
ATermList names, attrPath; Expr src, e; ATerm name, pos;
|
||||||
|
|
||||||
|
@ -95,7 +99,9 @@ static Expr fixAttrs(bool recursive, ATermList as)
|
||||||
throw ParseError(format("duplicate definition of attribute `%1%' at %2%")
|
throw ParseError(format("duplicate definition of attribute `%1%' at %2%")
|
||||||
% showAttrPath(ATmakeList1(*j)) % showPos(pos));
|
% showAttrPath(ATmakeList1(*j)) % showPos(pos));
|
||||||
Tree & t(attrs.children[*j]);
|
Tree & t(attrs.children[*j]);
|
||||||
t.leaf = fromScope ? makeVar(*j) : makeSelect(src, *j);
|
Expr leaf = fromScope ? makeVar(*j) : makeSelect(src, *j);
|
||||||
|
gcRoots.set(leaf, leaf);
|
||||||
|
t.leaf = leaf;
|
||||||
t.pos = pos;
|
t.pos = pos;
|
||||||
if (recursive && fromScope) t.recursive = false;
|
if (recursive && fromScope) t.recursive = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue