1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Fixed type resolution infinite loop

This commit is contained in:
Brian Fiete 2021-10-01 06:57:10 -07:00
parent 6b9bb361f9
commit 37e4c589b0
2 changed files with 12 additions and 5 deletions

View file

@ -1911,6 +1911,8 @@ bool BfAutoComplete::CheckExplicitInterface(BfTypeInstance* interfaceType, BfAst
else else
return false; return false;
mModule->PopulateType(interfaceType, BfPopulateType_DataAndMethods);
String filter; String filter;
if (isAutocompletingName) if (isAutocompletingName)
filter = GetFilter(memberName); filter = GetFilter(memberName);
@ -2544,7 +2546,7 @@ void BfAutoComplete::CheckProperty(BfPropertyDeclaration* propertyDeclaration)
{ {
BfTypeInstance* typeInst = NULL; BfTypeInstance* typeInst = NULL;
auto type = mModule->ResolveTypeRef(propertyDeclaration->mExplicitInterface, BfPopulateType_DataAndMethods); auto type = mModule->ResolveTypeRef(propertyDeclaration->mExplicitInterface, BfPopulateType_Identity);
if (type != NULL) if (type != NULL)
typeInst = type->ToTypeInstance(); typeInst = type->ToTypeInstance();

View file

@ -6860,13 +6860,18 @@ BfType* BfModule::ResolveTypeDef(BfTypeDef* typeDef, BfPopulateType populateType
return resolvedtypeDefType; return resolvedtypeDefType;
} }
// Get BaseClass even when we haven't populated the type yet2 // Get BaseClass even when we haven't populated the type yet
BfTypeInstance* BfModule::GetBaseType(BfTypeInstance* typeInst) BfTypeInstance* BfModule::GetBaseType(BfTypeInstance* typeInst)
{ {
if ((mContext->mCurTypeState != NULL) && (mContext->mCurTypeState->mTypeInstance == typeInst)) if (typeInst->mBaseType == NULL)
{ {
if (typeInst->mBaseType == NULL) auto checkTypeState = mContext->mCurTypeState;
return NULL; while (checkTypeState != NULL)
{
if (checkTypeState->mTypeInstance == typeInst)
return NULL;
checkTypeState = checkTypeState->mPrevState;
}
} }
if ((typeInst->mBaseType == NULL) && (typeInst != mContext->mBfObjectType)) if ((typeInst->mBaseType == NULL) && (typeInst != mContext->mBfObjectType))