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

Appended fields

This commit is contained in:
Brian Fiete 2022-06-27 10:55:31 -07:00
parent 52544e6782
commit 1d2811f50d
22 changed files with 596 additions and 52 deletions

View file

@ -1184,7 +1184,8 @@ void BfDefBuilder::Visit(BfFieldDeclaration* fieldDeclaration)
fieldDef->mProtection = BfProtection_Public;
fieldDef->mIsReadOnly = fieldDeclaration->mReadOnlySpecifier != NULL;
fieldDef->mIsInline = (fieldDeclaration->mReadOnlySpecifier != NULL) && (fieldDeclaration->mReadOnlySpecifier->GetToken() == BfToken_Inline);
fieldDef->mIsExtern = (fieldDeclaration->mExternSpecifier != NULL);
fieldDef->mIsExtern = (fieldDeclaration->mExternSpecifier != NULL) && (fieldDeclaration->mExternSpecifier->mToken == BfToken_Extern);
fieldDef->mIsAppend = (fieldDeclaration->mExternSpecifier != NULL) && (fieldDeclaration->mExternSpecifier->mToken == BfToken_Append);
auto constSpecifierToken = BfNodeDynCast<BfTokenNode>(fieldDeclaration->mConstSpecifier);
fieldDef->mIsConst = ((constSpecifierToken != NULL) && (constSpecifierToken->mToken == BfToken_Const)) || (isEnumEntryDecl);
if (auto usingSpecifier = BfNodeDynCast<BfUsingSpecifierNode>(fieldDeclaration->mConstSpecifier))
@ -2197,6 +2198,11 @@ void BfDefBuilder::FinishTypeDef(bool wantsToString)
}
if (field->GetFieldDeclaration()->mFieldDtor != NULL)
needsStaticDtor = true;
if (field->mIsAppend)
{
needsStaticInit = true;
needsStaticDtor = true;
}
}
}
@ -2222,6 +2228,11 @@ void BfDefBuilder::FinishTypeDef(bool wantsToString)
hasNonStaticField = true;
if (field->GetInitializer() != NULL)
needsDefaultCtor = true;
if (field->mIsAppend)
{
needsDefaultCtor = true;
needsDtor = true;
}
if (auto fieldDecl = field->GetFieldDeclaration())
{
if (fieldDecl->mFieldDtor != NULL)