Add lint error on importing package within a class (#5634) (#5679)

This commit is contained in:
Nick Brereton
2025-01-07 16:52:44 -05:00
committed by GitHub
parent e171463fa2
commit 87d856339f
6 changed files with 55 additions and 13 deletions
+7
View File
@@ -893,6 +893,13 @@ class LinkParseVisitor final : public VNVisitor {
}
iterateChildren(nodep);
}
void visit(AstPackageImport* nodep) override {
cleanFileline(nodep);
if (m_modp && !m_ftaskp && VN_IS(m_modp, Class)) {
nodep->v3error("Import statement directly within a class scope is illegal");
}
iterateChildren(nodep);
}
void visit(AstNode* nodep) override {
// Default: Just iterate