mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Fixed IsTypeUsed check for generic parameterized by interfaces
This commit is contained in:
parent
9e71acc003
commit
ee3aa7fc26
2 changed files with 9 additions and 8 deletions
|
@ -545,7 +545,7 @@ bool BfCompiler::IsTypeAccessible(BfType* checkType, BfProject* curProject)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool BfCompiler::IsTypeUsed(BfType* checkType, BfProject* curProject)
|
||||
bool BfCompiler::IsTypeUsed(BfType* checkType, BfProject* curProject, bool conservativeCheck)
|
||||
{
|
||||
if (mOptions.mCompileOnDemandKind == BfCompileOnDemandKind_AlwaysInclude)
|
||||
return IsTypeAccessible(checkType, curProject);
|
||||
|
@ -561,17 +561,17 @@ bool BfCompiler::IsTypeUsed(BfType* checkType, BfProject* curProject)
|
|||
// }
|
||||
|
||||
if (checkType->IsInterface())
|
||||
return typeInst->mIsReified;
|
||||
return typeInst->mIsReified || conservativeCheck;
|
||||
|
||||
//TODO: We could check to see if this project has any reified specialized instances...
|
||||
if (checkType->IsUnspecializedType())
|
||||
return typeInst->mIsReified;
|
||||
return typeInst->mIsReified || conservativeCheck;
|
||||
|
||||
if (checkType->IsTuple())
|
||||
{
|
||||
for (auto&& fieldInst : typeInst->mFieldInstances)
|
||||
{
|
||||
if (!IsTypeUsed(fieldInst.mResolvedType, curProject))
|
||||
if (!IsTypeUsed(fieldInst.mResolvedType, curProject, true))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ bool BfCompiler::IsTypeUsed(BfType* checkType, BfProject* curProject)
|
|||
if (genericTypeInst != NULL)
|
||||
{
|
||||
for (auto genericArg : genericTypeInst->mGenericTypeInfo->mTypeGenericArguments)
|
||||
if (!IsTypeUsed(genericArg, curProject))
|
||||
if (!IsTypeUsed(genericArg, curProject, true))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1264,8 +1264,9 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
|
|||
continue;
|
||||
|
||||
auto typeInst = type->ToTypeInstance();
|
||||
|
||||
if ((typeInst != NULL) && (!typeInst->IsReified()) && (!typeInst->IsUnspecializedType()))
|
||||
continue;
|
||||
continue;
|
||||
|
||||
if (!IsTypeUsed(type, project))
|
||||
continue;
|
||||
|
@ -1279,7 +1280,7 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
|
|||
{
|
||||
auto module = typeInst->mModule;
|
||||
if (module == NULL)
|
||||
continue;
|
||||
continue;
|
||||
|
||||
if (type->IsEnum())
|
||||
{
|
||||
|
|
|
@ -477,7 +477,7 @@ public:
|
|||
|
||||
public:
|
||||
bool IsTypeAccessible(BfType* checkType, BfProject* curProject);
|
||||
bool IsTypeUsed(BfType* checkType, BfProject* curProject);
|
||||
bool IsTypeUsed(BfType* checkType, BfProject* curProject, bool conservativeCheck = false);
|
||||
bool IsModuleAccessible(BfModule* module, BfProject* curProject);
|
||||
void FixVDataHash(BfModule* bfModule);
|
||||
void CheckModuleStringRefs(BfModule* module, BfVDataModule* vdataModule, int lastModuleRevision, HashSet<int>& foundStringIds, HashSet<int>& dllNameSet, Array<BfMethodInstance*>& dllMethods, Array<BfCompiler::StringValueEntry>& stringValueEntries);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue