Move curDTypeP test to loop

This commit is contained in:
Edmund Lam 2026-07-06 11:11:19 -04:00
parent f0f240209f
commit b6b745ffa3
1 changed files with 3 additions and 5 deletions

View File

@ -1324,6 +1324,7 @@ class ParamProcessor final {
AstMemberDType* const foundMemp = VN_CAST( AstMemberDType* const foundMemp = VN_CAST(
m_memberMap.findMember(structp, fieldRefp->name()), MemberDType); m_memberMap.findMember(structp, fieldRefp->name()), MemberDType);
if (!foundMemp) break; if (!foundMemp) break;
if (!foundMemp->subDTypep()) break;
totalLsb += foundMemp->lsb(); totalLsb += foundMemp->lsb();
sliceWidth = foundMemp->width(); sliceWidth = foundMemp->width();
curDTypep = foundMemp->subDTypep(); curDTypep = foundMemp->subDTypep();
@ -1339,11 +1340,8 @@ class ParamProcessor final {
= new AstSel{topp->fileline(), clonep, totalLsb, sliceWidth}; = new AstSel{topp->fileline(), clonep, totalLsb, sliceWidth};
// Match V3Width::memberSelStruct: skip RefDTypes to surface // Match V3Width::memberSelStruct: skip RefDTypes to surface
// enum dtype, and mark didWidth so V3Width doesn't reflatten. // enum dtype, and mark didWidth so V3Width doesn't reflatten.
// Only mark didWidth when we have a resolved dtype to attach. selp->dtypep(curDTypep->skipRefToEnump());
if (curDTypep) { selp->didWidth(true);
selp->dtypep(curDTypep->skipRefToEnump());
selp->didWidth(true);
}
topp->replaceWith(selp); topp->replaceWith(selp);
VL_DO_DANGLING(topp->deleteTree(), topp); VL_DO_DANGLING(topp->deleteTree(), topp);
} }