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

Fixed Object alloc clearing with extensions

This commit is contained in:
Brian Fiete 2022-02-15 12:21:56 -05:00
parent f0b5101a67
commit 6af0f111c0
2 changed files with 14 additions and 1 deletions

View file

@ -20410,7 +20410,20 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup,
auto thisVal = GetThis();
int prevSize = 0;
if (mContext->mBfObjectType != NULL)
{
prevSize = mContext->mBfObjectType->mInstSize;
PopulateType(mContext->mBfObjectType);
// If we have object extensions, clear out starting at the extension
for (auto& fieldInstance : mContext->mBfObjectType->mFieldInstances)
{
if (fieldInstance.GetFieldDef()->mDeclaringType->IsExtension())
{
prevSize = fieldInstance.mDataOffset;
break;
}
}
}
int curSize = mCurTypeInstance->mInstSize;
if (curSize > prevSize)
{