Fix super constructor calls with local variables, by using init functions (#6214) (#6933)

This commit is contained in:
Igor Zaworski
2026-03-04 17:55:55 -05:00
committed by GitHub
parent c34cd6ddf1
commit 7acd73fede
11 changed files with 122 additions and 94 deletions
+9 -3
View File
@@ -1338,9 +1338,15 @@ class TaskVisitor final : public VNVisitor {
if (!nodep->dpiImport() && !nodep->taskPublic()) {
// Need symbol table
if (cfuncp->name() == "new") {
const string stmt = VIdProtect::protect("_ctor_var_reset") + "(vlSymsp);";
cfuncp->addStmtsp(new AstCStmt{nodep->fileline(), stmt});
if (cfuncp->isConstructor()) {
bool isInterfaceClass = false;
if (const AstClass* const classp = VN_CAST(m_modp, Class)) {
isInterfaceClass = classp->isInterfaceClass();
}
if (!isInterfaceClass) {
const string stmt = VIdProtect::protect("_ctor_var_reset") + "(vlSymsp);";
cfuncp->addStmtsp(new AstCStmt{nodep->fileline(), stmt});
}
}
}
if (nodep->dpiContext()) {