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

Appended field type population issue fixed, circular ref handled

This commit is contained in:
Brian Fiete 2022-07-05 13:01:46 -07:00
parent f326df71d9
commit 7278e090a1
2 changed files with 14 additions and 4 deletions

View file

@ -5137,9 +5137,18 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
SetAndRestoreValue<BfFieldDef*> prevTypeRef(mContext->mCurTypeState->mCurFieldDef, fieldDef);
SetAndRestoreValue<BfTypeState::ResolveKind> prevResolveKind(mContext->mCurTypeState->mResolveKind, BfTypeState::ResolveKind_FieldType);
PopulateType(resolvedFieldType, BfPopulateType_Data);
auto fieldTypeInst = resolvedFieldType->ToTypeInstance();
dataSize = fieldTypeInst->mInstSize;
alignSize = fieldTypeInst->mInstAlign;
dataSize = BF_MAX(fieldTypeInst->mInstSize, 0);
alignSize = BF_MAX(fieldTypeInst->mInstAlign, 1);
if (fieldTypeInst->mTypeFailed)
{
TypeFailed(fieldTypeInst);
fieldInstance->mResolvedType = GetPrimitiveType(BfTypeCode_Var);
continue;
}
if ((typeInstance != NULL) && (fieldTypeInst->mTypeDef->mIsAbstract))
{
@ -5208,6 +5217,7 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
Fail("Append fields must be classes", nameRefNode, true);
}
BF_ASSERT(dataSize >= 0);
fieldInstance->mDataSize = dataSize;
if (!isUnion)
{