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