Internals: Defer DTypeRef versus IfaceDTypeRef determination into V3LinkDot, in preparation for future parser

This commit is contained in:
Wilson Snyder
2025-04-27 22:11:28 -04:00
parent 4c4a39a115
commit f983ce4875
5 changed files with 132 additions and 23 deletions
+9 -7
View File
@@ -131,11 +131,7 @@ class LinkCellsVisitor final : public VNVisitor {
AstNodeModule* findModuleSym(const string& modName) {
const VSymEnt* const foundp = m_mods.rootp()->findIdFallback(modName);
if (!foundp) {
return nullptr;
} else {
return VN_AS(foundp->nodep(), NodeModule);
}
return foundp ? VN_AS(foundp->nodep(), NodeModule) : nullptr;
}
AstNodeModule* resolveModule(AstNode* nodep, const string& modName) {
@@ -534,8 +530,14 @@ class LinkCellsVisitor final : public VNVisitor {
if (pinp->name() == "") pinp->name("__paramNumber" + cvtToStr(pinp->pinNum()));
}
if (m_varp) { // Parser didn't know what was interface, resolve now
const AstNodeModule* const varModp = findModuleSym(nodep->name());
if (VN_IS(varModp, Iface)) m_varp->setIfaceRef();
AstNodeModule* const varModp = findModuleSym(nodep->name());
if (AstIface* const ifacep = VN_CAST(varModp, Iface)) {
// Might be an interface, but might also not really be due to interface being
// hidden by another declaration. Assume it is relevant and order as-if.
// This is safe because an interface cannot instantiate a module, so false
// module->interface edges are harmless.
newEdge(vertex(m_modp), vertex(ifacep), 1, false);
}
}
}
void visit(AstClassOrPackageRef* nodep) override {