mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Added support for "case when" (valueless) switch cases
This commit is contained in:
parent
3fd81fc966
commit
857c1c384a
5 changed files with 25 additions and 11 deletions
|
@ -3264,11 +3264,15 @@ BfSwitchStatement* BfReducer::CreateSwitchStatement(BfTokenNode* tokenNode)
|
|||
{
|
||||
auto nextNode = mVisitorPos.GetNext();
|
||||
whenToken = BfNodeDynCast<BfTokenNode>(nextNode);
|
||||
if ((whenToken != NULL) && (whenToken->GetToken() != BfToken_When))
|
||||
if ((whenToken != NULL) && (whenToken->GetToken() == BfToken_When))
|
||||
{
|
||||
mVisitorPos.MoveNext();
|
||||
}
|
||||
else
|
||||
whenToken = NULL;
|
||||
}
|
||||
if (whenToken != NULL)
|
||||
{
|
||||
{
|
||||
auto whenExpr = mAlloc->Alloc<BfWhenExpression>();
|
||||
whenExpr->mWhenToken = whenToken;
|
||||
ReplaceNode(whenToken, whenExpr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue