mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-13 05:44:11 +02:00
Fixed tyoe population stack overflow issue with some invalid base typerefs
This commit is contained in:
parent
b017ccc2e1
commit
70da0856a7
1 changed files with 22 additions and 3 deletions
|
@ -2781,6 +2781,12 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
AssertErrorState();
|
AssertErrorState();
|
||||||
typeInstance->mTypeFailed = true;
|
typeInstance->mTypeFailed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_CheckTypeDone())
|
||||||
|
{
|
||||||
|
prevDefineState.CancelRestore();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Incase we had re-entry, work this through ourselves again here
|
// Incase we had re-entry, work this through ourselves again here
|
||||||
|
@ -3022,9 +3028,12 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
baseType = ResolveTypeDef(mCompiler->mFunctionTypeDef)->ToTypeInstance();
|
baseType = ResolveTypeDef(mCompiler->mFunctionTypeDef)->ToTypeInstance();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (auto checkTypeRef : typeDef->mBaseTypes)
|
for (auto checkTypeRef : typeDef->mBaseTypes)
|
||||||
{
|
{
|
||||||
|
if ((typeInstance->mDefineState == BfTypeDefineState_ResolvingBaseType) && (typeInstance->mTypeFailed))
|
||||||
|
break;
|
||||||
|
|
||||||
auto declTypeDef = typeDef;
|
auto declTypeDef = typeDef;
|
||||||
if (typeDef->mIsCombinedPartial)
|
if (typeDef->mIsCombinedPartial)
|
||||||
declTypeDef = typeDef->mPartials.front();
|
declTypeDef = typeDef->mPartials.front();
|
||||||
|
@ -3032,8 +3041,9 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
SetAndRestoreValue<BfTypeReference*> prevTypeRef(mContext->mCurTypeState->mCurBaseTypeRef, checkTypeRef);
|
SetAndRestoreValue<BfTypeReference*> prevTypeRef(mContext->mCurTypeState->mCurBaseTypeRef, checkTypeRef);
|
||||||
SetAndRestoreValue<BfTypeDefineState> prevDefineState(typeInstance->mDefineState, BfTypeDefineState_ResolvingBaseType);
|
SetAndRestoreValue<BfTypeDefineState> prevDefineState(typeInstance->mDefineState, BfTypeDefineState_ResolvingBaseType);
|
||||||
|
|
||||||
bool populateBase = !typeInstance->mTypeFailed;
|
bool populateBase = !typeInstance->mTypeFailed;
|
||||||
auto checkType = ResolveTypeRef(checkTypeRef, BfPopulateType_Declaration);
|
BfType* checkType = checkType = ResolveTypeRef(checkTypeRef, BfPopulateType_Declaration);
|
||||||
|
|
||||||
if ((checkType != NULL) && (!checkType->IsInterface()) && (populateBase))
|
if ((checkType != NULL) && (!checkType->IsInterface()) && (populateBase))
|
||||||
{
|
{
|
||||||
SetAndRestoreValue<BfTypeInstance*> prevBaseType(mContext->mCurTypeState->mCurBaseType, checkType->ToTypeInstance());
|
SetAndRestoreValue<BfTypeInstance*> prevBaseType(mContext->mCurTypeState->mCurBaseType, checkType->ToTypeInstance());
|
||||||
|
@ -3138,6 +3148,12 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_CheckTypeDone())
|
||||||
|
{
|
||||||
|
prevDefineState.CancelRestore();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3150,6 +3166,9 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
wantPopulateInterfaces = true;
|
wantPopulateInterfaces = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_CheckTypeDone())
|
||||||
|
return;
|
||||||
|
|
||||||
if (resolvedTypeRef->IsBoxed())
|
if (resolvedTypeRef->IsBoxed())
|
||||||
{
|
{
|
||||||
if ((baseType != NULL) && (baseType->IsStruct()))
|
if ((baseType != NULL) && (baseType->IsStruct()))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue