1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Added changes to support CompilerExplorer

This commit is contained in:
Brian Fiete 2019-10-11 05:58:08 -07:00
parent c97b074fee
commit c9e0ab6089
20 changed files with 389 additions and 156 deletions

View file

@ -149,7 +149,8 @@ void BfContext::AssignModule(BfType* type)
BF_ASSERT(!typeInst->mModule->mIsReified);
}
BfModule* module;
BfModule* module = NULL;
bool needsModuleInit = false;
// We used to have this "IsReified" check, but we DO want to create modules for unreified types even if they remain unused.
// What was that IsReified check catching?
@ -166,20 +167,46 @@ void BfContext::AssignModule(BfType* type)
BF_ASSERT(typeProcessEntry->mType->mContext == this);
BfLogSysM("HandleTypeWorkItem: %p -> %p\n", type, typeProcessEntry->mType);
mCompiler->mStats.mTypesQueued++;
mCompiler->UpdateCompletion();
mCompiler->UpdateCompletion();
}
else
{
auto typeInst = type->ToTypeInstance();
BF_ASSERT(typeInst != NULL);
String moduleName = GenerateModuleName(typeInst);
module = new BfModule(this, moduleName);
module->mIsReified = typeInst->mIsReified;
module->mProject = typeInst->mTypeDef->mProject;
typeInst->mModule = module;
BF_ASSERT(!mLockModules);
mModules.push_back(module);
auto project = typeInst->mTypeDef->mProject;
if ((project->mSingleModule) && (typeInst->mIsReified))
{
BfModule** modulePtr = NULL;
if (mProjectModule.TryAdd(project, NULL, &modulePtr))
{
String moduleName = project->mName;
module = new BfModule(this, moduleName);
module->mIsReified = true;
module->mProject = project;
typeInst->mModule = module;
BF_ASSERT(!mLockModules);
mModules.push_back(module);
*modulePtr = module;
needsModuleInit = true;
}
else
{
module = *modulePtr;
typeInst->mModule = module;
}
}
else
{
String moduleName = GenerateModuleName(typeInst);
module = new BfModule(this, moduleName);
module->mIsReified = typeInst->mIsReified;
module->mProject = project;
typeInst->mModule = module;
BF_ASSERT(!mLockModules);
mModules.push_back(module);
needsModuleInit = true;
}
}
auto localTypeInst = type->ToTypeInstance();
@ -191,7 +218,7 @@ void BfContext::AssignModule(BfType* type)
module->mOwnedTypeInstances.push_back(localTypeInst);
}
if (!module->mIsScratchModule)
if (needsModuleInit)
module->Init();
}