1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-15 14:54:09 +02:00

Added an error with a missing comma inside an initializer expr

This commit is contained in:
Brian Fiete 2023-03-14 07:19:21 -07:00
parent 723010fd9d
commit b6219ce80f

View file

@ -7568,14 +7568,20 @@ BfInitializerExpression* BfReducer::TryCreateInitializerExpression(BfAstNode* ta
bool foundComma = false; bool foundComma = false;
node = mVisitorPos.GetCurrent(); node = mVisitorPos.GetCurrent();
if (auto tokenNode = BfNodeDynCast<BfTokenNode>(node)) if (node != NULL)
{ {
if (tokenNode->mToken == BfToken_Comma) if (auto tokenNode = BfNodeDynCast<BfTokenNode>(node))
{ {
foundComma = true; if (tokenNode->mToken == BfToken_Comma)
commas.Add(tokenNode); {
isDone = !mVisitorPos.MoveNext(); foundComma = true;
commas.Add(tokenNode);
isDone = !mVisitorPos.MoveNext();
}
} }
if (!foundComma)
Fail("Expected ','", node);
} }
} }
} }