mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Improved support for boxed structs with emitted interfaces
This commit is contained in:
parent
e18bf57c87
commit
e8c763eb20
1 changed files with 34 additions and 14 deletions
|
@ -3654,6 +3654,19 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto typeInstance = resolvedTypeRef->ToTypeInstance();
|
auto typeInstance = resolvedTypeRef->ToTypeInstance();
|
||||||
|
|
||||||
|
BfTypeInstance* boxedUnderlyingTypeInstance = NULL;
|
||||||
|
if (typeInstance->IsBoxed())
|
||||||
|
{
|
||||||
|
auto underlyingType = typeInstance->GetUnderlyingType();
|
||||||
|
if (underlyingType->IsPrimitiveType())
|
||||||
|
boxedUnderlyingTypeInstance = GetPrimitiveStructType(((BfPrimitiveType*)underlyingType)->mTypeDef->mTypeCode);
|
||||||
|
else
|
||||||
|
boxedUnderlyingTypeInstance = underlyingType->ToTypeInstance();
|
||||||
|
|
||||||
|
typeInstance->mTypeDef = boxedUnderlyingTypeInstance->mTypeDef;
|
||||||
|
}
|
||||||
|
|
||||||
auto typeDef = typeInstance->mTypeDef;
|
auto typeDef = typeInstance->mTypeDef;
|
||||||
|
|
||||||
BF_ASSERT((typeInstance->mTypeDef->mNextRevision == NULL) || (mCompiler->IsAutocomplete()));
|
BF_ASSERT((typeInstance->mTypeDef->mNextRevision == NULL) || (mCompiler->IsAutocomplete()));
|
||||||
|
@ -4246,9 +4259,15 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
wantPopulateInterfaces = true;
|
wantPopulateInterfaces = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((typeInstance->mCeTypeInfo != NULL) && (!typeInstance->mCeTypeInfo->mPendingInterfaces.IsEmpty()))
|
// Handle CE interfaces
|
||||||
{
|
{
|
||||||
for (auto ifaceTypeId : typeInstance->mCeTypeInfo->mPendingInterfaces)
|
auto checkTypeInst = typeInstance;
|
||||||
|
if (boxedUnderlyingTypeInstance != NULL)
|
||||||
|
checkTypeInst = boxedUnderlyingTypeInstance;
|
||||||
|
|
||||||
|
if ((checkTypeInst->mCeTypeInfo != NULL) && (!checkTypeInst->mCeTypeInfo->mPendingInterfaces.IsEmpty()))
|
||||||
|
{
|
||||||
|
for (auto ifaceTypeId : checkTypeInst->mCeTypeInfo->mPendingInterfaces)
|
||||||
{
|
{
|
||||||
auto ifaceType = mContext->mTypes[ifaceTypeId];
|
auto ifaceType = mContext->mTypes[ifaceTypeId];
|
||||||
if ((ifaceType == NULL) || (!ifaceType->IsInterface()))
|
if ((ifaceType == NULL) || (!ifaceType->IsInterface()))
|
||||||
|
@ -4266,6 +4285,7 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_CheckTypeDone())
|
if (_CheckTypeDone())
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue