1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Allow attributes on local methods

This commit is contained in:
Brian Fiete 2022-05-27 11:28:53 -07:00
parent 8567072eef
commit f081365dab
4 changed files with 24 additions and 8 deletions

View file

@ -4134,7 +4134,7 @@ BfAstNode* BfReducer::DoCreateStatement(BfAstNode* node, CreateStmtFlags createS
}
else if (token == BfToken_LBracket)
{
return CreateAttributedStatement(tokenNode);
return CreateAttributedStatement(tokenNode, createStmtFlags);
}
}
@ -5663,15 +5663,23 @@ Do_RBracket:
return attributeDirective;
}
BfStatement* BfReducer::CreateAttributedStatement(BfTokenNode* tokenNode)
BfStatement* BfReducer::CreateAttributedStatement(BfTokenNode* tokenNode, CreateStmtFlags createStmtFlags)
{
auto attrib = CreateAttributeDirective(tokenNode);
if (attrib == NULL)
return NULL;
BfAstNode* stmt = CreateStatementAfter(attrib);
BfAstNode* stmt = CreateStatementAfter(attrib, createStmtFlags);
if (stmt != NULL)
{
{
if (auto localMethodDecl = BfNodeDynCastExact<BfLocalMethodDeclaration>(stmt))
{
BF_ASSERT(localMethodDecl->mMethodDeclaration->mAttributes == NULL);
localMethodDecl->mSrcStart = attrib->mSrcStart;
MEMBER_SET(localMethodDecl->mMethodDeclaration, mAttributes, attrib);
return localMethodDecl;
}
bool isValid = true;
auto checkNode = stmt;