| 6932 | } |
| 6933 | |
| 6934 | void BfCompiler::CompileReified() |
| 6935 | { |
| 6936 | BfLogSysM("BfCompiler::CompileReified\n"); |
| 6937 | BP_ZONE("Compile_ResolveTypeDefs"); |
| 6938 | |
| 6939 | Array<BfTypeDef*> deferTypeDefs; |
| 6940 | |
| 6941 | for (auto typeDef : mSystem->mTypeDefs) |
| 6942 | { |
| 6943 | mSystem->CheckLockYield(); |
| 6944 | if (mCanceling) |
| 6945 | { |
| 6946 | BfLogSysM("Canceling from Compile typeDef loop\n"); |
| 6947 | break; |
| 6948 | } |
| 6949 | |
| 6950 | if (typeDef->mProject->mDisabled) |
| 6951 | continue; |
| 6952 | |
| 6953 | if (typeDef->mIsPartial) |
| 6954 | continue; |
| 6955 | |
| 6956 | auto scratchModule = mContext->mScratchModule; |
| 6957 | bool isAlwaysInclude = (typeDef->mIsAlwaysInclude) || (typeDef->mProject->mAlwaysIncludeAll); |
| 6958 | |
| 6959 | auto typeOptions = scratchModule->GetTypeOptions(typeDef); |
| 6960 | if (typeOptions != NULL) |
| 6961 | isAlwaysInclude = typeOptions->Apply(isAlwaysInclude, BfOptionFlags_ReflectAlwaysIncludeType); |
| 6962 | |
| 6963 | if (typeDef->mProject->IsTestProject()) |
| 6964 | { |
| 6965 | for (auto methodDef : typeDef->mMethods) |
| 6966 | { |
| 6967 | auto methodDeclaration = methodDef->GetMethodDeclaration(); |
| 6968 | if ((methodDeclaration != NULL) && (methodDeclaration->mAttributes != NULL) && |
| 6969 | (methodDeclaration->mAttributes->Contains("Test"))) |
| 6970 | isAlwaysInclude = true; |
| 6971 | } |
| 6972 | } |
| 6973 | |
| 6974 | //TODO: Just because the type is required doesn't mean we want to reify it. Why did we have that check? |
| 6975 | if ((mOptions.mCompileOnDemandKind != BfCompileOnDemandKind_AlwaysInclude) && (!isAlwaysInclude)) |
| 6976 | { |
| 6977 | if (typeDef->mGenericParamDefs.IsEmpty()) |
| 6978 | deferTypeDefs.Add(typeDef); |
| 6979 | continue; |
| 6980 | } |
| 6981 | |
| 6982 | scratchModule->ResolveTypeDef(typeDef, BfPopulateType_Full); |
| 6983 | } |
| 6984 | |
| 6985 | // Resolve remaining typedefs as unreified so we can check their attributes |
| 6986 | for (auto typeDef : deferTypeDefs) |
| 6987 | { |
| 6988 | auto type = mContext->mUnreifiedModule->ResolveTypeDef(typeDef, BfPopulateType_Identity); |
| 6989 | if (type == NULL) |
| 6990 | continue; |
| 6991 | auto typeInst = type->ToTypeInstance(); |
nothing calls this directly
no test coverage detected