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

Better enum autocomplete hygiene

This commit is contained in:
Brian Fiete 2022-06-24 06:45:35 -07:00
parent fa1271b662
commit 20c88dfeb0
9 changed files with 109 additions and 37 deletions

View file

@ -851,7 +851,18 @@ void BfDefBuilder::ParseAttributes(BfAttributeDirective* attributes, BfMethodDef
methodDef->mHasComptime = true;
}
else if (typeRefName == "NoShow")
methodDef->mIsNoShow = true;
{
methodDef->mShow = BfShow_Hide;
if (!attributes->mArguments.IsEmpty())
{
if (auto literalExpr = BfNodeDynCast<BfLiteralExpression>(attributes->mArguments[0]))
{
if (literalExpr->mValue.mBool)
methodDef->mShow = BfShow_HideIndirect;
}
}
}
else if (typeRefName == "NoDiscard")
methodDef->mIsNoDiscard = true;
else if (typeRefName == "NoSplat")
@ -883,7 +894,7 @@ void BfDefBuilder::ParseAttributes(BfAttributeDirective* attributes, BfMethodDef
void BfDefBuilder::ParseAttributes(BfAttributeDirective* attributes, BfTypeDef* typeDef)
{
while (attributes != NULL)
{
{
if (attributes->mAttributeTypeRef != NULL)
{
auto typeRefName = attributes->mAttributeTypeRef->ToCleanAttributeString();
@ -891,7 +902,20 @@ void BfDefBuilder::ParseAttributes(BfAttributeDirective* attributes, BfTypeDef*
if (typeRefName == "AlwaysInclude")
typeDef->mIsAlwaysInclude = true;
else if (typeRefName == "NoDiscard")
typeDef->mIsNoDiscard = true;
typeDef->mIsNoDiscard = true;
else if (typeRefName == "NoShow")
{
typeDef->mShow = BfShow_Hide;
if (!attributes->mArguments.IsEmpty())
{
if (auto literalExpr = BfNodeDynCast<BfLiteralExpression>(attributes->mArguments[0]))
{
if (literalExpr->mValue.mBool)
typeDef->mShow = BfShow_HideIndirect;
}
}
}
}
attributes = attributes->mNextAttribute;