1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixed interface link error when base class is not instantiated

This commit is contained in:
Brian Fiete 2020-05-09 06:46:29 -07:00
parent b094bf4002
commit 1aa66761ad

View file

@ -4948,29 +4948,41 @@ void BfCompiler::PopulateReified()
}
}
for (auto& ifaceTypeInst : typeInst->mInterfaces)
auto checkType = typeInst;
while (checkType != NULL)
{
auto ifaceInst = ifaceTypeInst.mInterfaceType;
int startIdx = ifaceTypeInst.mStartInterfaceTableIdx;
int iMethodCount = (int)ifaceInst->mMethodInstanceGroups.size();
auto declTypeDef = ifaceTypeInst.mDeclaringType;
for (int iMethodIdx = 0; iMethodIdx < iMethodCount; iMethodIdx++)
if ((checkType != typeInst) && (checkType->mHasBeenInstantiated))
{
auto ifaceMethodInst = ifaceInst->mMethodInstanceGroups[iMethodIdx].mDefault;
if ((ifaceMethodInst == NULL) || (!ifaceMethodInst->IsReifiedAndImplemented()))
continue;
// We will already check this type here in its own loop
break;
}
auto implMethodRef = &typeInst->mInterfaceMethodTable[iMethodIdx + startIdx].mMethodRef;
BfMethodInstance* implMethod = *implMethodRef;
if (implMethod == NULL)
continue;
if (!implMethod->IsReifiedAndImplemented())
for (auto& ifaceTypeInst : checkType->mInterfaces)
{
auto ifaceInst = ifaceTypeInst.mInterfaceType;
int startIdx = ifaceTypeInst.mStartInterfaceTableIdx;
int iMethodCount = (int)ifaceInst->mMethodInstanceGroups.size();
auto declTypeDef = ifaceTypeInst.mDeclaringType;
for (int iMethodIdx = 0; iMethodIdx < iMethodCount; iMethodIdx++)
{
didWork = true;
typeInst->mModule->GetMethodInstance(implMethod);
auto ifaceMethodInst = ifaceInst->mMethodInstanceGroups[iMethodIdx].mDefault;
if ((ifaceMethodInst == NULL) || (!ifaceMethodInst->IsReifiedAndImplemented()))
continue;
auto implMethodRef = &checkType->mInterfaceMethodTable[iMethodIdx + startIdx].mMethodRef;
BfMethodInstance* implMethod = *implMethodRef;
if (implMethod == NULL)
continue;
if (!implMethod->IsReifiedAndImplemented())
{
didWork = true;
checkType->mModule->GetMethodInstance(implMethod);
}
}
}
checkType = checkType->mBaseType;
}
}
}