mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Fix extranous local:: error
This commit is contained in:
parent
32c789c355
commit
8e82440a55
@ -2147,7 +2147,7 @@ class LinkDotResolveVisitor final : public VNVisitor {
|
|||||||
enum DotPosition : uint8_t {
|
enum DotPosition : uint8_t {
|
||||||
// Must match ascii() method below
|
// Must match ascii() method below
|
||||||
DP_NONE = 0, // Not under a DOT
|
DP_NONE = 0, // Not under a DOT
|
||||||
DP_PACKAGE, // {package}:: DOT
|
DP_PACKAGE, // {package-or-class}:: DOT
|
||||||
DP_FIRST, // {scope-or-var} DOT
|
DP_FIRST, // {scope-or-var} DOT
|
||||||
DP_SCOPE, // DOT... {scope-or-var} DOT
|
DP_SCOPE, // DOT... {scope-or-var} DOT
|
||||||
DP_FINAL, // [DOT...] {var-or-func-or-dtype} with no following dots
|
DP_FINAL, // [DOT...] {var-or-func-or-dtype} with no following dots
|
||||||
@ -2814,7 +2814,7 @@ class LinkDotResolveVisitor final : public VNVisitor {
|
|||||||
bool allowFTask = false;
|
bool allowFTask = false;
|
||||||
bool staticAccess = false;
|
bool staticAccess = false;
|
||||||
if (m_ds.m_dotPos == DP_PACKAGE) {
|
if (m_ds.m_dotPos == DP_PACKAGE) {
|
||||||
// {package}::{a}
|
// {package-or-class}::{a}
|
||||||
AstNodeModule* classOrPackagep = nullptr;
|
AstNodeModule* classOrPackagep = nullptr;
|
||||||
expectWhat = "scope/variable/func";
|
expectWhat = "scope/variable/func";
|
||||||
allowScope = true;
|
allowScope = true;
|
||||||
@ -3179,20 +3179,37 @@ class LinkDotResolveVisitor final : public VNVisitor {
|
|||||||
nodep, "ClassRef has unlinked class");
|
nodep, "ClassRef has unlinked class");
|
||||||
UASSERT_OBJ(m_statep->forPrimary() || !nodep->paramsp(), nodep,
|
UASSERT_OBJ(m_statep->forPrimary() || !nodep->paramsp(), nodep,
|
||||||
"class reference parameter not removed by V3Param");
|
"class reference parameter not removed by V3Param");
|
||||||
VL_RESTORER(m_ds);
|
|
||||||
VL_RESTORER(m_pinSymp);
|
|
||||||
|
|
||||||
// ClassRef's have pins, so track
|
{
|
||||||
if (nodep->classOrPackagep()) {
|
// ClassRef's have pins, so track
|
||||||
m_pinSymp = m_statep->getNodeSym(nodep->classOrPackagep());
|
VL_RESTORER(m_ds);
|
||||||
|
VL_RESTORER(m_pinSymp);
|
||||||
|
|
||||||
|
if (nodep->classOrPackagep()) {
|
||||||
|
m_pinSymp = m_statep->getNodeSym(nodep->classOrPackagep());
|
||||||
|
}
|
||||||
|
AstClass* const refClassp = VN_CAST(nodep->classOrPackagep(), Class);
|
||||||
|
// Make sure any extends() are properly imported within referenced class
|
||||||
|
if (refClassp && !m_statep->forPrimary()) classExtendImport(refClassp);
|
||||||
|
|
||||||
|
m_ds.init(m_curSymp);
|
||||||
|
UINFO(4, indent() << "(Backto) Link ClassOrPackageRef: " << nodep << endl);
|
||||||
|
iterateChildren(nodep);
|
||||||
|
|
||||||
|
AstClass* const modClassp = VN_CAST(m_modp, Class);
|
||||||
|
if (m_statep->forPrimary() && refClassp && !nodep->paramsp()
|
||||||
|
&& nodep->classOrPackagep()->hasGParam()
|
||||||
|
// Don't warn on typedefs, which are hard to know if there's a param somewhere
|
||||||
|
// buried
|
||||||
|
&& VN_IS(nodep->classOrPackageNodep(), Class)
|
||||||
|
// References to class:: within class itself are OK per IEEE (UVM does this)
|
||||||
|
&& modClassp != refClassp) {
|
||||||
|
nodep->v3error(
|
||||||
|
"Reference to parameterized class without #() (IEEE 1800-2023 8.25.1)\n"
|
||||||
|
<< nodep->warnMore() << "... Suggest use '"
|
||||||
|
<< nodep->classOrPackageNodep()->prettyName() << "#()'");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
AstClass* const refClassp = VN_CAST(nodep->classOrPackagep(), Class);
|
|
||||||
// Make sure any extends() are properly imported within referenced class
|
|
||||||
if (refClassp && !m_statep->forPrimary()) classExtendImport(refClassp);
|
|
||||||
|
|
||||||
m_ds.init(m_curSymp);
|
|
||||||
UINFO(4, indent() << "(Backto) Link ClassOrPackageRef: " << nodep << endl);
|
|
||||||
iterateChildren(nodep);
|
|
||||||
|
|
||||||
if (nodep->name() == "local::") {
|
if (nodep->name() == "local::") {
|
||||||
if (!m_randSymp) {
|
if (!m_randSymp) {
|
||||||
@ -3202,17 +3219,6 @@ class LinkDotResolveVisitor final : public VNVisitor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AstClass* const modClassp = VN_CAST(m_modp, Class);
|
|
||||||
if (m_statep->forPrimary() && refClassp && !nodep->paramsp()
|
|
||||||
&& nodep->classOrPackagep()->hasGParam()
|
|
||||||
// Don't warn on typedefs, which are hard to know if there's a param somewhere buried
|
|
||||||
&& VN_IS(nodep->classOrPackageNodep(), Class)
|
|
||||||
// References to class:: within class itself are OK per IEEE (UVM does this)
|
|
||||||
&& modClassp != refClassp) {
|
|
||||||
nodep->v3error("Reference to parameterized class without #() (IEEE 1800-2023 8.25.1)\n"
|
|
||||||
<< nodep->warnMore() << "... Suggest use '"
|
|
||||||
<< nodep->classOrPackageNodep()->prettyName() << "#()'");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void visit(AstConstraintRef* nodep) override {
|
void visit(AstConstraintRef* nodep) override {
|
||||||
if (nodep->user3SetOnce()) return;
|
if (nodep->user3SetOnce()) return;
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
%Error: t/t_package_local_bad.v:9:16: Illegal 'local::' outside 'randomize() with' (IEEE 1800-2023 18.7.1)
|
%Error: t/t_package_local_bad.v:9:16: Illegal 'local::' outside 'randomize() with' (IEEE 1800-2023 18.7.1)
|
||||||
9 | $display(local::x);
|
9 | $display(local::x);
|
||||||
| ^~~~~
|
| ^~~~~
|
||||||
%Error: t/t_package_local_bad.v:9:23: Can't find definition of scope/variable/func: 'x'
|
|
||||||
9 | $display(local::x);
|
|
||||||
| ^
|
|
||||||
%Error: Exiting due to
|
%Error: Exiting due to
|
||||||
|
Loading…
Reference in New Issue
Block a user