Derive the prefix instead of hardcoding TOP__
This commit is contained in:
parent
22cb70a77d
commit
1d6d921488
|
|
@ -463,9 +463,7 @@ void EmitCFunc::emitVarReset(const string& prefix, AstVar* varp, bool constructi
|
||||||
// 'constructing' indicates that the object was just constructed, so if it is a string or
|
// 'constructing' indicates that the object was just constructed, so if it is a string or
|
||||||
// something that starts off clear already, no need to clear it again
|
// something that starts off clear already, no need to clear it again
|
||||||
AstNodeDType* const dtypep = varp->dtypep()->skipRefp();
|
AstNodeDType* const dtypep = varp->dtypep()->skipRefp();
|
||||||
const string vlSelf = m_cfuncp && m_cfuncp->isStatic()
|
const string vlSelf = VSelfPointerText::replaceThis(m_useSelfForThis, "this->");
|
||||||
? "vlSymsp->TOP__" + m_modp->name() + "."
|
|
||||||
: VSelfPointerText::replaceThis(m_useSelfForThis, "this->");
|
|
||||||
const string varNameProtected
|
const string varNameProtected
|
||||||
= ((VN_IS(m_modp, Class) || varp->isFuncLocal()) || !prefix.empty())
|
= ((VN_IS(m_modp, Class) || varp->isFuncLocal()) || !prefix.empty())
|
||||||
? varp->nameProtect()
|
? varp->nameProtect()
|
||||||
|
|
|
||||||
|
|
@ -573,8 +573,14 @@ public:
|
||||||
+ "\", " + std::to_string(nodep->fileline()->lineno()) + ")->"),
|
+ "\", " + std::to_string(nodep->fileline()->lineno()) + ")->"),
|
||||||
memberVarp, resetp->constructing());
|
memberVarp, resetp->constructing());
|
||||||
} else {
|
} else {
|
||||||
AstVar* const varp = VN_AS(fromp, NodeVarRef)->varp();
|
AstNodeVarRef* const fromVarRefp = VN_AS(fromp, NodeVarRef);
|
||||||
emitVarReset("", varp, resetp->constructing());
|
AstVar* const varp = fromVarRefp->varp();
|
||||||
|
const string prefix
|
||||||
|
= fromVarRefp->selfPointer().isEmpty()
|
||||||
|
? ""
|
||||||
|
: dereferenceString(
|
||||||
|
VN_AS(fromp, NodeVarRef)->selfPointerProtect(m_useSelfForThis));
|
||||||
|
emitVarReset(prefix, varp, resetp->constructing());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue