Add separate AstInitialStatic node for static initializers

Static variable initializers run before initial blocks, so use an
explicitly different procedure type for them. This also enables us to
now raise errors for assignments to const variables in initial blocks.
This commit is contained in:
Geza Lore
2022-04-23 15:12:49 +01:00
parent b22e368b25
commit 9abab2c366
9 changed files with 33 additions and 4 deletions
+1 -1
View File
@@ -275,7 +275,7 @@ private:
if (nodep->lifetime().isAutomatic()) {
nodep->addNextHere(new AstInitialAutomatic{newfl, assp});
} else {
nodep->addNextHere(new AstInitial{newfl, assp});
nodep->addNextHere(new AstInitialStatic{newfl, assp});
}
} // 4. Under blocks, it's an initial value to be under an assign
else {