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

Fixed GC marking of fields in object extension

This commit is contained in:
Brian Fiete 2022-02-15 17:43:30 -05:00
parent 9ca48c26f2
commit b0f019fdd3

View file

@ -18891,7 +18891,19 @@ void BfModule::EmitGCMarkMembers()
if (moduleMethodInst) if (moduleMethodInst)
{ {
auto methodBaseType = moduleMethodInst.mMethodInstance->GetOwner(); auto methodBaseType = moduleMethodInst.mMethodInstance->GetOwner();
if (methodBaseType != mContext->mBfObjectType) bool wantsBaseMarking = true;
if (methodBaseType == mContext->mBfObjectType)
{
PopulateType(methodBaseType);
for (auto& fieldInstance : mContext->mBfObjectType->mFieldInstances)
{
if ((fieldInstance.GetFieldDef()->mDeclaringType->IsExtension()) &&
(fieldInstance.mResolvedType->WantsGCMarking()))
wantsBaseMarking = true;
}
}
if (wantsBaseMarking)
{ {
auto thisValue = GetThis(); auto thisValue = GetThis();
auto baseValue = Cast(NULL, thisValue, methodBaseType, BfCastFlags_Explicit); auto baseValue = Cast(NULL, thisValue, methodBaseType, BfCastFlags_Explicit);