|
@@ -3708,9 +3708,6 @@ bool BfModule::CheckAccessMemberProtection(BfProtection protection, BfTypeInstan
|
|
|
|
|
|
bool BfModule::CheckDefineMemberProtection(BfProtection protection, BfType* memberType)
|
|
|
{
|
|
|
- // Use 'min' - exporting a 'public' from a 'private' class is really just 'private' still
|
|
|
- protection = std::min(protection, mCurTypeInstance->mTypeDef->mProtection);
|
|
|
-
|
|
|
auto memberTypeInstance = memberType->ToTypeInstance();
|
|
|
|
|
|
if (memberTypeInstance == NULL)
|
|
@@ -3721,6 +3718,20 @@ bool BfModule::CheckDefineMemberProtection(BfProtection protection, BfType* memb
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ if (memberTypeInstance->mTypeDef->mProtection < protection)
|
|
|
+ {
|
|
|
+ // Check for any definition up to the actual declared member type
|
|
|
+ auto commonOuterType = FindCommonOuterType(memberTypeInstance->mTypeDef, mCurTypeInstance->mTypeDef);
|
|
|
+ if (commonOuterType == memberTypeInstance->mTypeDef)
|
|
|
+ commonOuterType = commonOuterType->mOuterType;
|
|
|
+ auto checkTypeDef = mCurTypeInstance->mTypeDef;
|
|
|
+ while ((checkTypeDef != NULL) && (checkTypeDef != commonOuterType))
|
|
|
+ {
|
|
|
+ protection = std::min(protection, checkTypeDef->mProtection);
|
|
|
+ checkTypeDef = checkTypeDef->mOuterType;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (memberTypeInstance->mTypeDef->mProtection < protection)
|
|
|
return false;
|
|
|
|