mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
'not case' expression, case variable scope change
This commit is contained in:
parent
471897a150
commit
5feb0c044b
15 changed files with 133 additions and 19 deletions
|
@ -3691,6 +3691,26 @@ void BfParser::ParseBlock(BfBlock* astNode, int depth, bool isInterpolate)
|
|||
Fail("Unexpected ending brace");
|
||||
break;
|
||||
}
|
||||
else if (mToken == BfToken_Case)
|
||||
{
|
||||
if (childArr.mSize > 0)
|
||||
{
|
||||
auto prevNode = childArr[childArr.mSize - 1];
|
||||
if (auto prevIdentifier = BfNodeDynCastExact<BfIdentifierNode>(prevNode))
|
||||
{
|
||||
if (prevIdentifier->Equals("not"))
|
||||
{
|
||||
auto bfTokenNode = mAlloc->Alloc<BfTokenNode>();
|
||||
bfTokenNode->Init(prevIdentifier->mTriviaStart, prevIdentifier->mSrcStart, prevIdentifier->mSrcEnd);
|
||||
bfTokenNode->SetToken(BfToken_Not);
|
||||
childArr[childArr.mSize - 1] = bfTokenNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
astNode->Add(childNode);
|
||||
childArr.Add(childNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mToken == BfToken_LParen)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue