[SyntaxTree][NFC] Nit on `replaceChildRangeLowLevel`

This commit is contained in:
Eduardo Caldas 2020-10-14 09:39:34 +00:00
parent 72732acade
commit 6fbad9bf30
1 changed files with 3 additions and 3 deletions

View File

@ -99,6 +99,8 @@ void syntax::Tree::replaceChildRangeLowLevel(Node *BeforeBegin, Node *End,
assert((!End || End->Parent == this) && "`End` is not a child of `this`."); assert((!End || End->Parent == this) && "`End` is not a child of `this`.");
assert(canModify() && "Cannot modify `this`."); assert(canModify() && "Cannot modify `this`.");
Node *&Begin = BeforeBegin ? BeforeBegin->NextSibling : FirstChild;
#ifndef NDEBUG #ifndef NDEBUG
for (auto *N = New; N; N = N->NextSibling) { for (auto *N = New; N; N = N->NextSibling) {
assert(N->Parent == nullptr); assert(N->Parent == nullptr);
@ -116,10 +118,8 @@ void syntax::Tree::replaceChildRangeLowLevel(Node *BeforeBegin, Node *End,
}; };
assert(Reachable(FirstChild, BeforeBegin) && assert(Reachable(FirstChild, BeforeBegin) &&
"`BeforeBegin` is not reachable."); "`BeforeBegin` is not reachable.");
assert(Reachable(BeforeBegin ? BeforeBegin->NextSibling : FirstChild, End) && assert(Reachable(Begin, End) && "`End` is not after `BeforeBegin`.");
"`End` is not after `BeforeBegin`.");
#endif #endif
Node *&Begin = BeforeBegin ? BeforeBegin->NextSibling : FirstChild;
if (!New && Begin == End) if (!New && Begin == End)
return; return;