Internals: Fix suspicious dtype clone relinking. (#3056)

This commit is contained in:
Geza Lore 2021-07-01 19:33:44 +01:00 committed by GitHub
parent af27702188
commit d5c9369103
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -932,7 +932,9 @@ AstNode* AstNode::iterateSubtreeReturnEdits(AstNVisitor& v) {
void AstNode::cloneRelinkTree() {
// private: Cleanup clone() operation on whole tree. Publicly call cloneTree() instead.
for (AstNode* nodep = this; nodep; nodep = nodep->m_nextp) {
if (m_dtypep && m_dtypep->clonep()) m_dtypep = m_dtypep->clonep();
if (nodep->m_dtypep && nodep->m_dtypep->clonep()) {
nodep->m_dtypep = nodep->m_dtypep->clonep();
}
nodep->cloneRelink();
if (nodep->m_op1p) nodep->m_op1p->cloneRelinkTree();
if (nodep->m_op2p) nodep->m_op2p->cloneRelinkTree();