Fix iteration fixup in AstNode::addHereThisAsNext

Previous version broke verialor_ext_tests due to iteration order
mismatch after 3fc8249429
This commit is contained in:
Geza Lore 2022-07-20 13:07:26 +01:00
parent 1d400dd98c
commit 1c5e5704f5

View File

@ -674,10 +674,10 @@ void AstNode::addHereThisAsNext(AstNode* newp) {
tailp->m_headtailp = newp; tailp->m_headtailp = newp;
} }
// Iterator fixup // Iterator fixup
if (newLastp->m_iterpp) { if (newLastp->m_iterpp) *(newLastp->m_iterpp) = this;
*(newLastp->m_iterpp) = this; if (this->m_iterpp) {
} else if (this->m_iterpp) {
*(this->m_iterpp) = newp; *(this->m_iterpp) = newp;
this->m_iterpp = nullptr;
} }
// //
debugTreeChange(this, "-addHereThisAsNext: ", __LINE__, true); debugTreeChange(this, "-addHereThisAsNext: ", __LINE__, true);