mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Fixed protected internal node trivia
This commit is contained in:
parent
f28229aef4
commit
2e464ee556
1 changed files with 11 additions and 6 deletions
|
@ -7385,13 +7385,18 @@ bool BfReducer::SetProtection(BfAstNode* parentNode, BfAstNode*& protectionNodeR
|
||||||
((prevToken->mToken == BfToken_Internal) && (tokenNode->mToken == BfToken_Protected)))
|
((prevToken->mToken == BfToken_Internal) && (tokenNode->mToken == BfToken_Protected)))
|
||||||
{
|
{
|
||||||
auto tokenPair = mAlloc->Alloc<BfTokenPairNode>();
|
auto tokenPair = mAlloc->Alloc<BfTokenPairNode>();
|
||||||
ReplaceNode(protectionNodeRef, tokenPair);
|
|
||||||
MEMBER_SET(tokenPair, mLeft, prevToken);
|
if (prevToken->mSrcStart < tokenNode->mSrcStart)
|
||||||
MEMBER_SET(tokenPair, mRight, tokenNode);
|
|
||||||
|
|
||||||
if (tokenPair->mLeft->mSrcStart > tokenPair->mRight->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;
|
protectionNodeRef = tokenPair;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue