mirror of
https://github.com/verilator/verilator.git
synced 2026-09-08 18:36:36 +02:00
Fix referencing module variables above classes (#6304)
Signed-off-by: Artur Bieniek <[email protected]>
This commit is contained in:
+12
-3
@@ -68,9 +68,18 @@ class ScopeVisitor final : public VNVisitor {
|
||||
UASSERT_OBJ(it2 != m_packageScopes.end(), nodep, "Can't locate package scope");
|
||||
scopep = it2->second;
|
||||
}
|
||||
const auto it3 = m_varScopes.find(std::make_pair(nodep->varp(), scopep));
|
||||
UASSERT_OBJ(it3 != m_varScopes.end(), nodep, "Can't locate varref scope");
|
||||
AstVarScope* const varscp = it3->second;
|
||||
// Search up the scope hierarchy for the variable
|
||||
AstVarScope* varscp = nullptr;
|
||||
AstScope* searchScopep = scopep;
|
||||
while (searchScopep) {
|
||||
const auto it3 = m_varScopes.find(std::make_pair(nodep->varp(), searchScopep));
|
||||
if (it3 != m_varScopes.end()) {
|
||||
varscp = it3->second;
|
||||
break;
|
||||
}
|
||||
searchScopep = searchScopep->aboveScopep();
|
||||
}
|
||||
UASSERT_OBJ(varscp, nodep, "Can't locate varref scope");
|
||||
nodep->varScopep(varscp);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user