MCPcopy Create free account
hub / github.com/beefytech/Beef / CheckDefineMemberProtection

Method CheckDefineMemberProtection

IDEHelper/Compiler/BfModule.cpp:3705–3735  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3703}
3704
3705bool BfModule::CheckDefineMemberProtection(BfProtection protection, BfType* memberType)
3706{
3707 // Use 'min' - exporting a 'public' from a 'private' class is really just 'private' still
3708 protection = std::min(protection, mCurTypeInstance->mTypeDef->mProtection);
3709
3710 auto memberTypeInstance = memberType->ToTypeInstance();
3711
3712 if (memberTypeInstance == NULL)
3713 {
3714 auto underlyingType = memberType->GetUnderlyingType();
3715 if (underlyingType != NULL)
3716 return CheckDefineMemberProtection(protection, underlyingType);
3717 return true;
3718 }
3719
3720 if (memberTypeInstance->mTypeDef->mProtection < protection)
3721 return false;
3722
3723 if (memberTypeInstance->IsGenericTypeInstance())
3724 {
3725 // When we're a generic struct, our data layout can depend on our generic parameters as well
3726 auto genericTypeInstance = (BfTypeInstance*) memberTypeInstance;
3727 for (auto typeGenericArg : genericTypeInstance->mGenericTypeInfo->mTypeGenericArguments)
3728 {
3729 if (!CheckDefineMemberProtection(protection, typeGenericArg))
3730 return false;
3731 }
3732 }
3733
3734 return true;
3735}
3736
3737void BfModule::AddDependency(BfType* usedType, BfType* userType, BfDependencyMap::DependencyFlags flags, BfDepContext* depContext)
3738{

Callers

nothing calls this directly

Calls 3

ToTypeInstanceMethod · 0.45
GetUnderlyingTypeMethod · 0.45
IsGenericTypeInstanceMethod · 0.45

Tested by

no test coverage detected