diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index bafff9b3..40bd8b39 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -11702,7 +11702,17 @@ void BfModule::GetCustomAttributes(BfCustomAttributes* customAttributes, BfAttri continue; } - BfType* attrType = ResolveTypeRef(attributesDirective->mAttributeTypeRef, BfPopulateType_Identity, (BfResolveTypeRefFlags)(BfResolveTypeRefFlag_Attribute | BfResolveTypeRefFlag_NoReify)); + BfType* attrType; + if (mContext->mCurTypeState != NULL) + { + SetAndRestoreValue prevTypeRef(mContext->mCurTypeState->mCurAttributeTypeRef, attributesDirective->mAttributeTypeRef); + attrType = ResolveTypeRef(attributesDirective->mAttributeTypeRef, BfPopulateType_Identity, (BfResolveTypeRefFlags)(BfResolveTypeRefFlag_Attribute | BfResolveTypeRefFlag_NoReify)); + } + else + { + attrType = ResolveTypeRef(attributesDirective->mAttributeTypeRef, BfPopulateType_Identity, (BfResolveTypeRefFlags)(BfResolveTypeRefFlag_Attribute | BfResolveTypeRefFlag_NoReify)); + } + BfTypeDef* attrTypeDef = NULL; if ((attrType != NULL) && (attrType->IsTypeInstance())) attrTypeDef = attrType->ToTypeInstance()->mTypeDef; diff --git a/IDEHelper/Compiler/BfModuleTypeUtils.cpp b/IDEHelper/Compiler/BfModuleTypeUtils.cpp index a691017d..a680207d 100644 --- a/IDEHelper/Compiler/BfModuleTypeUtils.cpp +++ b/IDEHelper/Compiler/BfModuleTypeUtils.cpp @@ -3873,7 +3873,7 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy if ((checkType != NULL) && (!checkType->IsInterface()) && (populateBase)) { SetAndRestoreValue prevBaseType(mContext->mCurTypeState->mCurBaseType, checkType->ToTypeInstance()); - PopulateType(checkType, BfPopulateType_Data); + PopulateType(checkType, (populateType <= BfPopulateType_BaseType) ? BfPopulateType_BaseType : BfPopulateType_Data); } if (typeInstance->mDefineState >= BfTypeDefineState_Defined) @@ -4331,25 +4331,33 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy SetAndRestoreValue prevSkipTypeProtectionChecks(typeInstance->mSkipTypeProtectionChecks, true); if (typeDef->mIsCombinedPartial) { + auto customAttributes = new BfCustomAttributes(); + for (auto partialTypeDef : typeDef->mPartials) { if (partialTypeDef->mTypeDeclaration->mAttributes == NULL) continue; typeState.mCurTypeDef = partialTypeDef; - if (typeInstance->mCustomAttributes == NULL) - typeInstance->mCustomAttributes = new BfCustomAttributes(); - GetCustomAttributes(typeInstance->mCustomAttributes, partialTypeDef->mTypeDeclaration->mAttributes, attrTarget); + GetCustomAttributes(customAttributes, partialTypeDef->mTypeDeclaration->mAttributes, attrTarget); } + + if (typeInstance->mCustomAttributes == NULL) + typeInstance->mCustomAttributes = customAttributes; + else + delete customAttributes; } else { - - typeInstance->mCustomAttributes = new BfCustomAttributes(); - GetCustomAttributes(typeInstance->mCustomAttributes, typeDef->mTypeDeclaration->mAttributes, attrTarget); + auto customAttributes = new BfCustomAttributes(); + GetCustomAttributes(customAttributes, typeDef->mTypeDeclaration->mAttributes, attrTarget); + if (typeInstance->mCustomAttributes == NULL) + typeInstance->mCustomAttributes = customAttributes; + else + delete customAttributes; } } - } + } } if (typeInstance->mTypeOptionsIdx == -2)