Fix handling of static keyword in methods (#4649)

This commit is contained in:
Ryszard Rozak
2023-10-31 08:15:54 -04:00
committed by GitHub
parent a27abab65f
commit a764c70b4a
14 changed files with 60 additions and 34 deletions
+4 -13
View File
@@ -292,19 +292,10 @@ private:
nodep->v3warn(STATICVAR, "Static variable with assignment declaration declared in a "
"loop converted to automatic");
}
if (m_ftaskp) {
bool classMethod = m_ftaskp->classMethod();
if (!classMethod) {
AstClassOrPackageRef* const pkgrefp
= VN_CAST(m_ftaskp->classOrPackagep(), ClassOrPackageRef);
if (pkgrefp && VN_IS(pkgrefp->classOrPackagep(), Class)) classMethod = true;
}
if (classMethod && nodep->lifetime().isNone()) {
nodep->lifetime(VLifetime::AUTOMATIC);
}
}
if (nodep->lifetime().isNone() && nodep->varType() != VVarType::PORT) {
nodep->lifetime(m_lifetime);
if (nodep->varType() != VVarType::PORT) {
if (nodep->lifetime().isNone()) nodep->lifetime(m_lifetime);
} else if (m_ftaskp) {
nodep->lifetime(VLifetime::AUTOMATIC);
}
if (nodep->isGParam() && !nodep->isAnsi()) { // shadow some parameters into localparams