1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Parse fix with misplaced custom attributes

This commit is contained in:
Brian Fiete 2022-04-16 14:29:43 -07:00
parent 166ff4d5e3
commit 87f3aa0335

View file

@ -6302,6 +6302,17 @@ BfAstNode* BfReducer::ReadTypeMember(BfTokenNode* tokenNode, bool declStarted, i
nextNode = mVisitorPos.GetNext();
if (nextNode != NULL)
{
if (auto nextTokenNode = BfNodeDynCast<BfTokenNode>(nextNode))
{
if ((nextTokenNode->mToken == BfToken_LBracket) && (depth > 0))
{
// We can't apply this to a custom attribute
AddErrorNode(tokenNode);
Fail("Unexpected token", tokenNode);
return NULL;
}
}
mVisitorPos.MoveNext();
typeMember = ReadTypeMember(nextNode, true, depth + 1);
}
@ -6800,6 +6811,12 @@ BfAstNode* BfReducer::ReadTypeMember(BfAstNode* node, bool declStarted, int dept
}
}
if ((token == BfToken_LBracket) && (depth > 0))
{
Fail("Unexpected custom attribute", node);
return NULL;
}
if (isTypeRef)
{
// Handled below