1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-16 23:34:10 +02:00

Fixed method slotting when method is already in work list

This commit is contained in:
Brian Fiete 2022-01-27 06:18:11 -05:00
parent 37c4074c44
commit 7e03ce86bc

View file

@ -5636,18 +5636,24 @@ void BfModule::DoTypeInstanceMethodProcessing(BfTypeInstance* typeInstance)
if ((pass == 1) != (methodDef->mIsOverride)) if ((pass == 1) != (methodDef->mIsOverride))
continue; continue;
bool doGetMethodInstance = true;
auto methodInstanceGroup = &typeInstance->mMethodInstanceGroups[methodDef->mIdx]; auto methodInstanceGroup = &typeInstance->mMethodInstanceGroups[methodDef->mIdx];
if ((methodInstanceGroup->mOnDemandKind != BfMethodOnDemandKind_AlwaysInclude) && if ((methodInstanceGroup->mOnDemandKind != BfMethodOnDemandKind_AlwaysInclude) &&
(methodInstanceGroup->mOnDemandKind != BfMethodOnDemandKind_Decl_AwaitingDecl)) (methodInstanceGroup->mOnDemandKind != BfMethodOnDemandKind_Decl_AwaitingDecl))
{ {
BfLogSysM("Skipping GetMethodInstance on MethodDef: %p OnDemandKind: %d\n", methodDef, methodInstanceGroup->mOnDemandKind); BfLogSysM("Skipping GetMethodInstance on MethodDef: %p OnDemandKind: %d\n", methodDef, methodInstanceGroup->mOnDemandKind);
continue; doGetMethodInstance = false;
} }
if (methodDef->mMethodType == BfMethodType_Init) if (methodDef->mMethodType == BfMethodType_Init)
continue; doGetMethodInstance = false;
BfMethodInstance* methodInstance = NULL;
if (doGetMethodInstance)
{
int prevWorklistSize = (int)mContext->mMethodWorkList.size(); int prevWorklistSize = (int)mContext->mMethodWorkList.size();
auto flags = ((methodDef->mGenericParams.size() != 0) || (typeInstance->IsUnspecializedType())) ? BfGetMethodInstanceFlag_UnspecializedPass : BfGetMethodInstanceFlag_None; auto flags = ((methodDef->mGenericParams.size() != 0) || (typeInstance->IsUnspecializedType())) ? BfGetMethodInstanceFlag_UnspecializedPass : BfGetMethodInstanceFlag_None;
@ -5657,7 +5663,7 @@ void BfModule::DoTypeInstanceMethodProcessing(BfTypeInstance* typeInstance)
auto moduleMethodInstance = GetMethodInstance(typeInstance, methodDef, BfTypeVector(), flags); auto moduleMethodInstance = GetMethodInstance(typeInstance, methodDef, BfTypeVector(), flags);
auto methodInstance = moduleMethodInstance.mMethodInstance; methodInstance = moduleMethodInstance.mMethodInstance;
if (methodInstance == NULL) if (methodInstance == NULL)
{ {
BF_ASSERT(typeInstance->IsGenericTypeInstance() && (typeInstance->mTypeDef->mIsCombinedPartial)); BF_ASSERT(typeInstance->IsGenericTypeInstance() && (typeInstance->mTypeDef->mIsCombinedPartial));
@ -5729,7 +5735,13 @@ void BfModule::DoTypeInstanceMethodProcessing(BfTypeInstance* typeInstance)
BF_ASSERT(methodInstanceGroup->mOnDemandKind != BfMethodOnDemandKind_Decl_AwaitingReference); BF_ASSERT(methodInstanceGroup->mOnDemandKind != BfMethodOnDemandKind_Decl_AwaitingReference);
} }
} }
}
else
{
methodInstance = methodInstanceGroup->mDefault;
if (methodInstance == NULL)
continue;
}
bool methodUsedVirtually = false; bool methodUsedVirtually = false;
if (typeInstance->IsInterface()) if (typeInstance->IsInterface())