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

Fixed GetStructRetIdx calculation with closure 'this' override

This commit is contained in:
Brian Fiete 2021-01-27 06:20:18 -08:00
parent ea34f0c2fd
commit cd882b09a5

View file

@ -764,15 +764,17 @@ int BfMethodInstance::GetStructRetIdx(bool forceStatic)
if ((returnTypeInst != NULL) && (returnTypeInst->mHasUnderlyingArray))
return -1;
auto owner = mMethodInstanceGroup->mOwner;
if (owner->mModule->mCompiler->mOptions.mPlatformType != BfPlatformType_Windows)
auto thisType = mMethodInstanceGroup->mOwner;
if (thisType->mModule->mCompiler->mOptions.mPlatformType != BfPlatformType_Windows)
return 0;
if ((mMethodInfoEx != NULL) && (mMethodInfoEx->mClosureInstanceInfo != NULL) && (mMethodInfoEx->mClosureInstanceInfo->mThisOverride != NULL))
thisType = mMethodInfoEx->mClosureInstanceInfo->mThisOverride;
if ((!HasThis()) || (forceStatic))
return 0;
if (!owner->IsValueType())
if (!thisType->IsValueType())
return 1;
if ((mMethodDef->mIsMutating) || (!owner->IsSplattable()) || ((!AllowsSplatting(-1)) && (!owner->GetLoweredType(BfTypeUsage_Parameter))))
if ((mMethodDef->mIsMutating) || (!thisType->IsSplattable()) || ((!AllowsSplatting(-1)) && (!thisType->GetLoweredType(BfTypeUsage_Parameter))))
return 1;
return 0;
}
@ -1170,6 +1172,11 @@ void BfMethodInstance::GetIRFunctionInfo(BfModule* module, BfIRType& returnType,
{
module->PopulateType(mReturnType);
if (mMethodDef->mName.Contains("GroupBy$"))
{
NOP;
}
BfTypeCode loweredReturnTypeCode = BfTypeCode_None;
BfTypeCode loweredReturnTypeCode2 = BfTypeCode_None;
if ((!module->mIsComptimeModule) && (GetLoweredReturnType(&loweredReturnTypeCode, &loweredReturnTypeCode2)))