1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Fixed dependency of alias types

This commit is contained in:
Brian Fiete 2022-03-19 12:24:56 -07:00
parent ad35a8a254
commit c6a7af2a4b
4 changed files with 31 additions and 12 deletions

View file

@ -3497,7 +3497,7 @@ bool BfModule::CheckDefineMemberProtection(BfProtection protection, BfType* memb
return true;
}
void BfModule::AddDependency(BfType* usedType, BfType* userType, BfDependencyMap::DependencyFlags flags)
void BfModule::AddDependency(BfType* usedType, BfType* userType, BfDependencyMap::DependencyFlags flags, BfDepContext* depContext)
{
if (usedType == userType)
return;
@ -3650,12 +3650,23 @@ void BfModule::AddDependency(BfType* usedType, BfType* userType, BfDependencyMap
if (usedType->IsTypeAlias())
{
usedType = SafeResolveAliasType((BfTypeAliasType*)usedType);
if (usedType == NULL)
return;
}
auto underlyingType = usedType->GetUnderlyingType();
if (underlyingType != NULL)
{
BfDepContext newDepContext;
if (depContext == NULL)
depContext = &newDepContext;
if (!usedType->IsGenericTypeInstance())
if (++depContext->mAliasDepth > 8)
{
if (!depContext->mDeepSeenAliases.Add(underlyingType))
return; // Circular!
}
AddDependency(underlyingType, userType, depFlag);
}
}
else if (!usedType->IsGenericTypeInstance())
{
auto underlyingType = usedType->GetUnderlyingType();
if (underlyingType != NULL)