1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Fixed protected internal node trivia

This commit is contained in:
Brian Fiete 2020-12-14 06:27:14 -08:00
parent f28229aef4
commit 2e464ee556

View file

@ -7385,13 +7385,18 @@ bool BfReducer::SetProtection(BfAstNode* parentNode, BfAstNode*& protectionNodeR
((prevToken->mToken == BfToken_Internal) && (tokenNode->mToken == BfToken_Protected)))
{
auto tokenPair = mAlloc->Alloc<BfTokenPairNode>();
ReplaceNode(protectionNodeRef, tokenPair);
MEMBER_SET(tokenPair, mLeft, prevToken);
MEMBER_SET(tokenPair, mRight, tokenNode);
if (tokenPair->mLeft->mSrcStart > tokenPair->mRight->mSrcStart)
if (prevToken->mSrcStart < tokenNode->mSrcStart)
{
BF_SWAP(tokenPair->mLeft, tokenPair->mRight);
ReplaceNode(prevToken, tokenPair);
MEMBER_SET(tokenPair, mLeft, prevToken);
MEMBER_SET(tokenPair, mRight, tokenNode);
}
else
{
ReplaceNode(tokenNode, tokenPair);
MEMBER_SET(tokenPair, mLeft, tokenNode);
MEMBER_SET(tokenPair, mRight, prevToken);
}
protectionNodeRef = tokenPair;