| 2731 | } |
| 2732 | |
| 2733 | bool BfTypeInstance::IsTypeMemberIncluded(BfTypeDef* typeDef, BfTypeDef* activeTypeDef, BfModule* module) |
| 2734 | { |
| 2735 | if (mGenericTypeInfo == NULL) |
| 2736 | return true; |
| 2737 | if (mGenericTypeInfo->mGenericExtensionInfo == NULL) |
| 2738 | return true; |
| 2739 | if ((typeDef == NULL) || (typeDef == activeTypeDef)) |
| 2740 | return true; |
| 2741 | |
| 2742 | // The combined type declaration is the root type declaration, it's implicitly included |
| 2743 | if (typeDef->mTypeDeclaration == mTypeDef->mTypeDeclaration) |
| 2744 | return true; |
| 2745 | |
| 2746 | BfGenericExtensionEntry* genericExEntry = NULL; |
| 2747 | if (!mGenericTypeInfo->mGenericExtensionInfo->mExtensionMap.TryGetValue(typeDef, &genericExEntry)) |
| 2748 | return true; |
| 2749 | |
| 2750 | if (mGenericTypeInfo->mIsUnspecialized) |
| 2751 | { |
| 2752 | if (module == NULL) |
| 2753 | return true; // During population |
| 2754 | |
| 2755 | auto declConstraints = &genericExEntry->mGenericParams; |
| 2756 | |
| 2757 | for (int genericIdx = 0; genericIdx < (int)declConstraints->size(); genericIdx++) |
| 2758 | { |
| 2759 | auto declGenericParam = (*declConstraints)[genericIdx]; |
| 2760 | |
| 2761 | BfType* genericArg; |
| 2762 | if (genericIdx < (int)mGenericTypeInfo->mTypeGenericArguments.size()) |
| 2763 | { |
| 2764 | genericArg = mGenericTypeInfo->mTypeGenericArguments[genericIdx]; |
| 2765 | } |
| 2766 | else |
| 2767 | { |
| 2768 | genericArg = declGenericParam->mExternType; |
| 2769 | } |
| 2770 | |
| 2771 | if ((genericArg == NULL) || (!module->CheckGenericConstraints(BfGenericParamSource(), genericArg, NULL, declGenericParam))) |
| 2772 | return false; |
| 2773 | } |
| 2774 | |
| 2775 | return true; |
| 2776 | } |
| 2777 | |
| 2778 | return genericExEntry->mConstraintsPassed; |
| 2779 | } |
| 2780 | |
| 2781 | bool BfTypeInstance::IsZeroGap() |
| 2782 | { |
no test coverage detected