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

Proper error for anonymous type declarations in emitted code

This commit is contained in:
Brian Fiete 2025-01-05 09:07:36 -08:00
parent 854122cb46
commit 61a3328c5a

View file

@ -49,6 +49,7 @@ BfReducer::BfReducer()
mMethodDepth = 0; mMethodDepth = 0;
mDocumentCheckIdx = 0; mDocumentCheckIdx = 0;
mTypeMemberNodeStart = NULL; mTypeMemberNodeStart = NULL;
mCurTypeState = NULL;
} }
bool BfReducer::IsSemicolon(BfAstNode* node) bool BfReducer::IsSemicolon(BfAstNode* node)
@ -8260,7 +8261,13 @@ void BfReducer::InitAnonymousType(BfTypeDeclaration* typeDecl)
memcpy(typeDecl->mAnonymousName, name.c_str(), len); memcpy(typeDecl->mAnonymousName, name.c_str(), len);
if (mCurTypeState != NULL) if (mCurTypeState != NULL)
{
mCurTypeState->mAnonymousTypeDecls.Add(typeDecl); mCurTypeState->mAnonymousTypeDecls.Add(typeDecl);
}
else
{
Fail("Type declarations are not allowed in emitted code", typeDecl);
}
} }
bool BfReducer::CheckInlineTypeRefAttribute(BfAstNode* typeRef, BfAttributeDirective* attributes) bool BfReducer::CheckInlineTypeRefAttribute(BfAstNode* typeRef, BfAttributeDirective* attributes)