Add AstInitialAutomatic as prep for static class members

This commit is contained in:
Wilson Snyder
2022-01-02 12:35:44 -05:00
parent 84ee833ea7
commit e334740dd6
8 changed files with 27 additions and 5 deletions
+5 -1
View File
@@ -272,7 +272,11 @@ private:
auto* const assp
= new AstAssign(newfl, new AstVarRef(newfl, nodep->name(), VAccess::WRITE),
nodep->valuep()->unlinkFrBack());
nodep->addNextHere(new AstInitial(newfl, assp));
if (nodep->lifetime().isAutomatic()) {
nodep->addNextHere(new AstInitialAutomatic{newfl, assp});
} else {
nodep->addNextHere(new AstInitial{newfl, assp});
}
} // 4. Under blocks, it's an initial value to be under an assign
else {
nodep->addNextHere(new AstAssign(fl,