mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BfCompiler::IsTypeUsed(BfType* checkType, BfProject* curProject)
|
bool BfCompiler::IsTypeUsed(BfType* checkType, BfProject* curProject, bool conservativeCheck)
|
||||||
{
|
{
|
||||||
if (mOptions.mCompileOnDemandKind == BfCompileOnDemandKind_AlwaysInclude)
|
if (mOptions.mCompileOnDemandKind == BfCompileOnDemandKind_AlwaysInclude)
|
||||||
return IsTypeAccessible(checkType, curProject);
|
return IsTypeAccessible(checkType, curProject);
|
||||||
|
@ -561,17 +561,17 @@ bool BfCompiler::IsTypeUsed(BfType* checkType, BfProject* curProject)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (checkType->IsInterface())
|
if (checkType->IsInterface())
|
||||||
return typeInst->mIsReified;
|
return typeInst->mIsReified || conservativeCheck;
|
||||||
|
|
||||||
//TODO: We could check to see if this project has any reified specialized instances...
|
//TODO: We could check to see if this project has any reified specialized instances...
|
||||||
if (checkType->IsUnspecializedType())
|
if (checkType->IsUnspecializedType())
|
||||||
return typeInst->mIsReified;
|
return typeInst->mIsReified || conservativeCheck;
|
||||||
|
|
||||||
if (checkType->IsTuple())
|
if (checkType->IsTuple())
|
||||||
{
|
{
|
||||||
for (auto&& fieldInst : typeInst->mFieldInstances)
|
for (auto&& fieldInst : typeInst->mFieldInstances)
|
||||||
{
|
{
|
||||||
if (!IsTypeUsed(fieldInst.mResolvedType, curProject))
|
if (!IsTypeUsed(fieldInst.mResolvedType, curProject, true))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -580,7 +580,7 @@ bool BfCompiler::IsTypeUsed(BfType* checkType, BfProject* curProject)
|
||||||
if (genericTypeInst != NULL)
|
if (genericTypeInst != NULL)
|
||||||
{
|
{
|
||||||
for (auto genericArg : genericTypeInst->mGenericTypeInfo->mTypeGenericArguments)
|
for (auto genericArg : genericTypeInst->mGenericTypeInfo->mTypeGenericArguments)
|
||||||
if (!IsTypeUsed(genericArg, curProject))
|
if (!IsTypeUsed(genericArg, curProject, true))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1264,8 +1264,9 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto typeInst = type->ToTypeInstance();
|
auto typeInst = type->ToTypeInstance();
|
||||||
|
|
||||||
if ((typeInst != NULL) && (!typeInst->IsReified()) && (!typeInst->IsUnspecializedType()))
|
if ((typeInst != NULL) && (!typeInst->IsReified()) && (!typeInst->IsUnspecializedType()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!IsTypeUsed(type, project))
|
if (!IsTypeUsed(type, project))
|
||||||
continue;
|
continue;
|
||||||
|
@ -1279,7 +1280,7 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
|
||||||
{
|
{
|
||||||
auto module = typeInst->mModule;
|
auto module = typeInst->mModule;
|
||||||
if (module == NULL)
|
if (module == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (type->IsEnum())
|
if (type->IsEnum())
|
||||||
{
|
{
|
||||||
|
|
|
@ -477,7 +477,7 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool IsTypeAccessible(BfType* checkType, BfProject* curProject);
|
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);
|
bool IsModuleAccessible(BfModule* module, BfProject* curProject);
|
||||||
void FixVDataHash(BfModule* bfModule);
|
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);
|
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