1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixed a PopulateType reentry issue

This commit is contained in:
Brian Fiete 2020-04-09 14:55:25 -07:00
parent accc74957a
commit 66aeb0a302

View file

@ -1467,12 +1467,20 @@ bool BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
if (typeInstance->mResolvingConstField)
return !typeInstance->mTypeFailed;
if (typeInstance->mNeedsMethodProcessing)
auto _CheckTypeDone = [&]()
{
if ((canDoMethodProcessing) && (populateType >= BfPopulateType_DataAndMethods))
DoTypeInstanceMethodProcessing(typeInstance);
return true;
}
if (typeInstance->mNeedsMethodProcessing)
{
BF_ASSERT(typeInstance->mDefineState >= BfTypeDefineState_Defined);
if ((canDoMethodProcessing) && (populateType >= BfPopulateType_DataAndMethods))
DoTypeInstanceMethodProcessing(typeInstance);
return true;
}
return false;
};
if (_CheckTypeDone())
return true;
// Partial population break out point
if ((populateType >= BfPopulateType_Identity) && (populateType <= BfPopulateType_IdentityNoRemapAlias))
@ -1509,6 +1517,9 @@ bool BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
BuildGenericParams(resolvedTypeRef);
}
if (_CheckTypeDone())
return true;
// Don't do TypeToString until down here. Otherwise we can infinitely loop on BuildGenericParams
bool isStruct = resolvedTypeRef->IsStruct();
@ -2108,6 +2119,7 @@ bool BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
}
}
BF_ASSERT(!typeInstance->mNeedsMethodProcessing);
typeInstance->mDefineState = BfTypeDefineState_HasInterfaces;
if (populateType <= BfPopulateType_Interfaces)
return true;