Strengthen AstNode types to AstNodeExpr

Declare every AstNode children and variables as AstNodeExpr where we
statically know this is the appropriate sub-type.
This commit is contained in:
Geza Lore
2022-11-20 19:31:28 +00:00
parent 352d0b4582
commit 3abb65d732
52 changed files with 1742 additions and 1572 deletions
+3 -3
View File
@@ -184,7 +184,7 @@ private:
= new AstVarRef{fl, enumValueTabp(enumDtp), VAccess::READ};
tabRefp->classOrPackagep(v3Global.rootp()->dollarUnitPkgAddp());
AstRand* const randp = new AstRand{fl, nullptr, false};
AstNode* const moddivp = new AstModDiv{
AstNodeExpr* const moddivp = new AstModDiv{
fl, randp, new AstConst{fl, static_cast<uint32_t>(enumDtp->itemCount())}};
randp->dtypep(varrefp->findBasicDType(VBasicDTypeKwd::UINT32));
moddivp->dtypep(enumDtp);
@@ -296,7 +296,7 @@ private:
for (AstCaseItem* itemp = nodep->itemsp(); itemp;
itemp = VN_AS(itemp->nextp(), CaseItem)) {
AstNode* const condp = itemp->condsp()->unlinkFrBack();
AstNodeExpr* const condp = itemp->condsp()->unlinkFrBack();
sump
= new AstAdd{condp->fileline(), sump, new AstExtend{itemp->fileline(), condp, 64}};
AstNode* const stmtsp
@@ -318,7 +318,7 @@ private:
ifsp->addElsesp(dispp);
AstNode* newp = randVarp;
AstNode* randp = new AstRand{fl, nullptr, false};
AstNodeExpr* randp = new AstRand{fl, nullptr, false};
randp->dtypeSetUInt64();
newp->addNext(new AstAssign{fl, new AstVarRef{fl, randVarp, VAccess::WRITE},
new AstAdd{fl, new AstConst{fl, AstConst::Unsized64{}, 1},