mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Disabled custom attributes when boxed
This commit is contained in:
parent
67dadf34e5
commit
bb59aa3162
1 changed files with 36 additions and 33 deletions
|
@ -2096,42 +2096,45 @@ bool BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
typeInstance->mInstSize = std::max(0, typeInstance->mInstSize);
|
typeInstance->mInstSize = std::max(0, typeInstance->mInstSize);
|
||||||
typeInstance->mInstAlign = std::max(0, typeInstance->mInstAlign);
|
typeInstance->mInstAlign = std::max(0, typeInstance->mInstAlign);
|
||||||
|
|
||||||
if ((typeInstance->mCustomAttributes == NULL) && (typeDef->mTypeDeclaration != NULL) && (typeDef->mTypeDeclaration->mAttributes != NULL))
|
if (!typeInstance->IsBoxed())
|
||||||
{
|
{
|
||||||
BfAttributeTargets attrTarget;
|
if ((typeInstance->mCustomAttributes == NULL) && (typeDef->mTypeDeclaration != NULL) && (typeDef->mTypeDeclaration->mAttributes != NULL))
|
||||||
if ((typeDef->mIsDelegate) || (typeDef->mIsFunction))
|
|
||||||
attrTarget = BfAttributeTargets_Delegate;
|
|
||||||
else if (typeInstance->IsEnum())
|
|
||||||
attrTarget = BfAttributeTargets_Enum;
|
|
||||||
else if (typeInstance->IsInterface())
|
|
||||||
attrTarget = BfAttributeTargets_Interface;
|
|
||||||
else if (typeInstance->IsStruct())
|
|
||||||
attrTarget = BfAttributeTargets_Struct;
|
|
||||||
else
|
|
||||||
attrTarget = BfAttributeTargets_Class;
|
|
||||||
if (!typeInstance->mTypeFailed)
|
|
||||||
{
|
{
|
||||||
// This allows us to avoid reentrancy when checking for inner types
|
BfAttributeTargets attrTarget;
|
||||||
SetAndRestoreValue<bool> prevSkipTypeProtectionChecks(typeInstance->mSkipTypeProtectionChecks, true);
|
if ((typeDef->mIsDelegate) || (typeDef->mIsFunction))
|
||||||
if (typeDef->mIsCombinedPartial)
|
attrTarget = BfAttributeTargets_Delegate;
|
||||||
{
|
else if (typeInstance->IsEnum())
|
||||||
for (auto partialTypeDef : typeDef->mPartials)
|
attrTarget = BfAttributeTargets_Enum;
|
||||||
{
|
else if (typeInstance->IsInterface())
|
||||||
if (partialTypeDef->mTypeDeclaration->mAttributes == NULL)
|
attrTarget = BfAttributeTargets_Interface;
|
||||||
continue;
|
else if (typeInstance->IsStruct())
|
||||||
BfTypeState typeState;
|
attrTarget = BfAttributeTargets_Struct;
|
||||||
typeState.mPrevState = mContext->mCurTypeState;
|
|
||||||
typeState.mCurTypeDef = partialTypeDef;
|
|
||||||
typeState.mTypeInstance = typeInstance;
|
|
||||||
SetAndRestoreValue<BfTypeState*> prevTypeState(mContext->mCurTypeState, &typeState);
|
|
||||||
|
|
||||||
if (typeInstance->mCustomAttributes == NULL)
|
|
||||||
typeInstance->mCustomAttributes = new BfCustomAttributes();
|
|
||||||
GetCustomAttributes(typeInstance->mCustomAttributes, partialTypeDef->mTypeDeclaration->mAttributes, attrTarget);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
typeInstance->mCustomAttributes = GetCustomAttributes(typeDef->mTypeDeclaration->mAttributes, attrTarget);
|
attrTarget = BfAttributeTargets_Class;
|
||||||
|
if (!typeInstance->mTypeFailed)
|
||||||
|
{
|
||||||
|
// This allows us to avoid reentrancy when checking for inner types
|
||||||
|
SetAndRestoreValue<bool> prevSkipTypeProtectionChecks(typeInstance->mSkipTypeProtectionChecks, true);
|
||||||
|
if (typeDef->mIsCombinedPartial)
|
||||||
|
{
|
||||||
|
for (auto partialTypeDef : typeDef->mPartials)
|
||||||
|
{
|
||||||
|
if (partialTypeDef->mTypeDeclaration->mAttributes == NULL)
|
||||||
|
continue;
|
||||||
|
BfTypeState typeState;
|
||||||
|
typeState.mPrevState = mContext->mCurTypeState;
|
||||||
|
typeState.mCurTypeDef = partialTypeDef;
|
||||||
|
typeState.mTypeInstance = typeInstance;
|
||||||
|
SetAndRestoreValue<BfTypeState*> prevTypeState(mContext->mCurTypeState, &typeState);
|
||||||
|
|
||||||
|
if (typeInstance->mCustomAttributes == NULL)
|
||||||
|
typeInstance->mCustomAttributes = new BfCustomAttributes();
|
||||||
|
GetCustomAttributes(typeInstance->mCustomAttributes, partialTypeDef->mTypeDeclaration->mAttributes, attrTarget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
typeInstance->mCustomAttributes = GetCustomAttributes(typeDef->mTypeDeclaration->mAttributes, attrTarget);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue