diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index 81a522577..64a7aab4a 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -2246,9 +2246,9 @@ private: } } void importSymbolsFromExtended(AstClass* const nodep, AstClassExtends* const cextp) { - AstClass* const classp = cextp->classp(); - VSymEnt* const srcp = m_statep->getNodeSym(classp); - if (classp->isInterfaceClass()) importImplementsClass(nodep, srcp, classp); + AstClass* const baseClassp = cextp->classp(); + VSymEnt* const srcp = m_statep->getNodeSym(baseClassp); + if (baseClassp->isInterfaceClass()) importImplementsClass(nodep, srcp, baseClassp); if (!cextp->isImplements()) m_curSymp->importFromClass(m_statep->symsp(), srcp); } bool checkPinRef(AstPin* pinp, VVarType refVarType) { @@ -2445,9 +2445,9 @@ private: } else { const auto cextp = classp->extendsp(); UASSERT_OBJ(cextp, nodep, "Bad super extends link"); - const auto sclassp = cextp->classp(); - UASSERT_OBJ(sclassp, nodep, "Bad superclass"); - m_ds.m_dotSymp = m_statep->getNodeSym(sclassp); + const auto baseClassp = cextp->classp(); + UASSERT_OBJ(baseClassp, nodep, "Bad superclass"); + m_ds.m_dotSymp = m_statep->getNodeSym(baseClassp); UINFO(8, " super. " << m_ds.ascii() << endl); } } @@ -2896,15 +2896,16 @@ private: "class reference parameter not removed by V3Param"); VL_RESTORER(m_ds); VL_RESTORER(m_pinSymp); - { - // ClassRef's have pins, so track - if (nodep->classOrPackagep()) { - m_pinSymp = m_statep->getNodeSym(nodep->classOrPackagep()); - } - m_ds.init(m_curSymp); - UINFO(4, "(Backto) Link ClassOrPackageRef: " << nodep << endl); - iterateChildren(nodep); + + // ClassRef's have pins, so track + if (nodep->classOrPackagep()) { + m_pinSymp = m_statep->getNodeSym(nodep->classOrPackagep()); } + m_ds.init(m_curSymp); + UINFO(4, "(Backto) Link ClassOrPackageRef: " << nodep << endl); + + iterateChildren(nodep); + AstClass* const refClassp = VN_CAST(nodep->classOrPackagep(), Class); AstClass* const modClassp = VN_CAST(m_modp, Class); if (m_statep->forPrimary() && refClassp && !nodep->paramsp() @@ -3506,26 +3507,26 @@ private: } } - if (AstClass* const classp = cextp->classOrNullp()) { + if (AstClass* const baseClassp = cextp->classOrNullp()) { // Already converted. Update symbol table to link unlinked members. // Base class has to be visited in a case if its extends statement // needs to be handled. Recursive inheritance was already checked. - if (classp == nodep) { + if (baseClassp == nodep) { cextp->v3error("Attempting to extend class " << nodep->prettyNameQ() << " from itself"); - } else if (cextp->isImplements() && !classp->isInterfaceClass()) { + } else if (cextp->isImplements() && !baseClassp->isInterfaceClass()) { cextp->v3error("Attempting to implement from non-interface class " - << classp->prettyNameQ() << '\n' + << baseClassp->prettyNameQ() << '\n' << "... Suggest use 'extends'"); } else if (!cextp->isImplements() && !nodep->isInterfaceClass() - && classp->isInterfaceClass()) { + && baseClassp->isInterfaceClass()) { cextp->v3error("Attempting to extend from interface class " - << classp->prettyNameQ() << '\n' + << baseClassp->prettyNameQ() << '\n' << "... Suggest use 'implements'"); } - classp->isExtended(true); + baseClassp->isExtended(true); nodep->isExtended(true); - iterate(classp); + iterate(baseClassp); importSymbolsFromExtended(nodep, cextp); continue; } @@ -3742,6 +3743,7 @@ void V3LinkDot::linkDotGuts(AstNetlist* rootp, VLinkDotStep step) { state.computeScopeAliases(); state.dumpSelf(); { LinkDotResolveVisitor{rootp, &state}; } + state.dumpSelf(); } void V3LinkDot::linkDotPrimary(AstNetlist* nodep) {