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

Method CompileReified

IDEHelper/Compiler/BfCompiler.cpp:6934–7017  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6932}
6933
6934void 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();

Callers

nothing calls this directly

Calls 11

IsTestProjectMethod · 0.80
GetMethodDeclarationMethod · 0.80
CheckLockYieldMethod · 0.45
GetTypeOptionsMethod · 0.45
ApplyMethod · 0.45
ContainsMethod · 0.45
IsEmptyMethod · 0.45
AddMethod · 0.45
ResolveTypeDefMethod · 0.45
ToTypeInstanceMethod · 0.45
PopulateTypeMethod · 0.45

Tested by

no test coverage detected