Fix converting subclasses to string (#3552)
This commit is contained in:
parent
93272c13fd
commit
0eeb40b975
|
|
@ -87,10 +87,10 @@ static void makeToStringMiddle(AstClass* nodep) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nodep->extendsp() && nodep->extendsp()->classp()->user1()) {
|
if (nodep->extendsp() && nodep->extendsp()->classp()->user1()) {
|
||||||
string stmt = "out += \"";
|
string stmt = "out += ";
|
||||||
if (!comma.empty()) stmt += "\", \"+ ";
|
if (!comma.empty()) stmt += "\", \"+ ";
|
||||||
// comma = ", "; // Nothing further so not needed
|
// comma = ", "; // Nothing further so not needed
|
||||||
stmt += nodep->extendsp()->dtypep()->nameProtect();
|
stmt += EmitCBaseVisitor::prefixNameProtect(nodep->extendsp()->dtypep());
|
||||||
stmt += "::to_string_middle();\n";
|
stmt += "::to_string_middle();\n";
|
||||||
nodep->user1(true); // So what we extend dumps this
|
nodep->user1(true); // So what we extend dumps this
|
||||||
funcp->addStmtsp(new AstCStmt{nodep->fileline(), stmt});
|
funcp->addStmtsp(new AstCStmt{nodep->fileline(), stmt});
|
||||||
|
|
@ -104,13 +104,13 @@ static void makeToStringMiddle(AstClass* nodep) {
|
||||||
|
|
||||||
void V3Common::commonAll() {
|
void V3Common::commonAll() {
|
||||||
UINFO(2, __FUNCTION__ << ": " << endl);
|
UINFO(2, __FUNCTION__ << ": " << endl);
|
||||||
|
// NODE STATE
|
||||||
|
// Entire netlist:
|
||||||
|
// AstClass::user1() -> bool. True if class needs to_string dumper
|
||||||
|
const VNUser1InUse m_inuser1;
|
||||||
// Create common contents for each module
|
// Create common contents for each module
|
||||||
for (AstNode* nodep = v3Global.rootp()->modulesp(); nodep; nodep = nodep->nextp()) {
|
for (AstNode* nodep = v3Global.rootp()->modulesp(); nodep; nodep = nodep->nextp()) {
|
||||||
if (AstClass* const classp = VN_CAST(nodep, Class)) {
|
if (AstClass* const classp = VN_CAST(nodep, Class)) {
|
||||||
// NODE STATE
|
|
||||||
// Entire netlist:
|
|
||||||
// AstClass::user1() -> bool. True if class needs to_string dumper
|
|
||||||
const VNUser1InUse m_inuser1;
|
|
||||||
// Create ToString methods
|
// Create ToString methods
|
||||||
makeVlToString(classp);
|
makeVlToString(classp);
|
||||||
makeToString(classp);
|
makeToString(classp);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue