mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-11 04:52:21 +02:00
Optimization to finding symbol references in file
This commit is contained in:
parent
468b5e292d
commit
cd26d44a62
1 changed files with 20 additions and 15 deletions
|
@ -4109,6 +4109,23 @@ BfType* BfCompiler::CheckSymbolReferenceTypeRef(BfModule* module, BfTypeReferenc
|
||||||
return resolvedType;
|
return resolvedType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BfCompiler::AddToRebuildTypeList(BfTypeInstance* typeInst, HashSet<BfTypeInstance*>& rebuildTypeInstList)
|
||||||
|
{
|
||||||
|
if (mResolvePassData->mParser != NULL)
|
||||||
|
{
|
||||||
|
// Only find references within the current file
|
||||||
|
if (!typeInst->mTypeDef->HasSource(mResolvePassData->mParser))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool allowRebuild = ((!typeInst->IsGenericTypeInstance()) ||
|
||||||
|
((typeInst->IsUnspecializedType()) && (!typeInst->IsUnspecializedTypeVariation())));
|
||||||
|
if ((typeInst->IsClosure()) || (typeInst->IsConcreteInterfaceType()) || (typeInst->IsRetTypeType()))
|
||||||
|
allowRebuild = false;
|
||||||
|
if (allowRebuild)
|
||||||
|
rebuildTypeInstList.Add(typeInst);
|
||||||
|
}
|
||||||
|
|
||||||
void BfCompiler::AddDepsToRebuildTypeList(BfTypeInstance* replaceTypeInst, HashSet<BfTypeInstance*>& rebuildTypeInstList)
|
void BfCompiler::AddDepsToRebuildTypeList(BfTypeInstance* replaceTypeInst, HashSet<BfTypeInstance*>& rebuildTypeInstList)
|
||||||
{
|
{
|
||||||
for (auto& dep : replaceTypeInst->mDependencyMap)
|
for (auto& dep : replaceTypeInst->mDependencyMap)
|
||||||
|
@ -4118,19 +4135,7 @@ void BfCompiler::AddDepsToRebuildTypeList(BfTypeInstance* replaceTypeInst, HashS
|
||||||
if (depTypeInst == NULL)
|
if (depTypeInst == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (mResolvePassData->mParser != NULL)
|
AddToRebuildTypeList(depTypeInst, rebuildTypeInstList);
|
||||||
{
|
|
||||||
// Only find references within the current file
|
|
||||||
if (!depTypeInst->mTypeDef->HasSource(mResolvePassData->mParser))
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool allowRebuild = ((!depTypeInst->IsGenericTypeInstance()) ||
|
|
||||||
((depTypeInst->IsUnspecializedType()) && (!depTypeInst->IsUnspecializedTypeVariation())));
|
|
||||||
if ((depTypeInst->IsClosure()) || (depTypeInst->IsConcreteInterfaceType()) || (depTypeInst->IsRetTypeType()))
|
|
||||||
allowRebuild = false;
|
|
||||||
if (allowRebuild)
|
|
||||||
rebuildTypeInstList.Add(depTypeInst);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4174,7 +4179,7 @@ void BfCompiler::GetSymbolReferences()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rebuildTypeInstList.Add(replaceTypeInst);
|
AddToRebuildTypeList(replaceTypeInst, rebuildTypeInstList);
|
||||||
|
|
||||||
//TODO: Did we need this to be rebuildTypeInst->mModule??? Why?
|
//TODO: Did we need this to be rebuildTypeInst->mModule??? Why?
|
||||||
//auto rebuildModule = rebuildTypeInst->mModule;
|
//auto rebuildModule = rebuildTypeInst->mModule;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue