mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 12:02:21 +02:00
Type recursion fix for splattable check
This commit is contained in:
parent
e82f9ce3ee
commit
9bc292e4b9
1 changed files with 16 additions and 7 deletions
|
@ -6121,12 +6121,19 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
{
|
{
|
||||||
int dataCount = 0;
|
int dataCount = 0;
|
||||||
|
|
||||||
std::function<void(BfType*)> splatIterate;
|
std::function<void(BfType*, int)> splatIterate;
|
||||||
splatIterate = [&](BfType* checkType)
|
splatIterate = [&](BfType* checkType, int depth)
|
||||||
{
|
{
|
||||||
if (hadNonSplattable)
|
if (hadNonSplattable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (depth > 64)
|
||||||
|
{
|
||||||
|
// Stop trying
|
||||||
|
hadNonSplattable = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (checkType->IsValueType())
|
if (checkType->IsValueType())
|
||||||
PopulateType(checkType, BfPopulateType_Data);
|
PopulateType(checkType, BfPopulateType_Data);
|
||||||
|
|
||||||
|
@ -6144,7 +6151,7 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
{
|
{
|
||||||
auto checkTypeInstance = checkType->ToTypeInstance();
|
auto checkTypeInstance = checkType->ToTypeInstance();
|
||||||
if (checkTypeInstance->mBaseType != NULL)
|
if (checkTypeInstance->mBaseType != NULL)
|
||||||
splatIterate(checkTypeInstance->mBaseType);
|
splatIterate(checkTypeInstance->mBaseType, depth + 1);
|
||||||
|
|
||||||
if (checkTypeInstance->mIsUnion)
|
if (checkTypeInstance->mIsUnion)
|
||||||
{
|
{
|
||||||
|
@ -6153,7 +6160,7 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
if (!wantSplat)
|
if (!wantSplat)
|
||||||
hadNonSplattable = true;
|
hadNonSplattable = true;
|
||||||
|
|
||||||
splatIterate(unionInnerType);
|
splatIterate(unionInnerType, depth + 1);
|
||||||
|
|
||||||
if (checkTypeInstance->IsEnum())
|
if (checkTypeInstance->IsEnum())
|
||||||
dataCount++; // Discriminator
|
dataCount++; // Discriminator
|
||||||
|
@ -6172,7 +6179,7 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fieldInstance->mDataIdx >= 0)
|
if (fieldInstance->mDataIdx >= 0)
|
||||||
splatIterate(fieldInstance->GetResolvedType());
|
splatIterate(fieldInstance->GetResolvedType(), depth + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6184,7 +6191,7 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
dataCount += checkType->GetSplatCount();
|
dataCount += checkType->GetSplatCount();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
splatIterate(typeInstance);
|
splatIterate(typeInstance, 0);
|
||||||
|
|
||||||
if (isCRepr)
|
if (isCRepr)
|
||||||
{
|
{
|
||||||
|
@ -10678,7 +10685,9 @@ BfTypeDef* BfModule::FindTypeDef(const BfAtomComposite& findName, int numGeneric
|
||||||
isValid = mCurMethodInstance->mMethodDef->mDeclaringType == useTypeDef;
|
isValid = mCurMethodInstance->mMethodDef->mDeclaringType == useTypeDef;
|
||||||
}
|
}
|
||||||
|
|
||||||
BF_ASSERT(isValid);
|
if (!isValid)
|
||||||
|
InternalError("Invalid useTypeDef in FindTypeDef");
|
||||||
|
//BF_ASSERT(isValid);
|
||||||
|
|
||||||
typeLookupEntryPtr->mAtomUpdateIdx = typeLookupEntry.mName.GetAtomUpdateIdx();
|
typeLookupEntryPtr->mAtomUpdateIdx = typeLookupEntry.mName.GetAtomUpdateIdx();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue