mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Sanity check for mid-compile deleted types
This commit is contained in:
parent
547c9908f5
commit
18f7a5bd09
1 changed files with 24 additions and 0 deletions
|
@ -20715,6 +20715,21 @@ void BfModule::ProcessMethod(BfMethodInstance* methodInstance, bool isInlineDup,
|
|||
return;
|
||||
}
|
||||
|
||||
auto _SanityCheckType = [&](BfType* type)
|
||||
{
|
||||
if ((type != NULL) && (type->IsDeleting()))
|
||||
{
|
||||
InternalError("Method references deleted type", methodDef->GetRefNode());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
if (!_SanityCheckType(methodInstance->mReturnType))
|
||||
return;
|
||||
for (int paramIdx = 0; paramIdx < methodInstance->GetParamCount(); paramIdx++)
|
||||
if (!_SanityCheckType(methodInstance->GetParamType(paramIdx)))
|
||||
return;
|
||||
|
||||
StringT<512> mangledName;
|
||||
BfMangler::Mangle(mangledName, mCompiler->GetMangleKind(), mCurMethodInstance);
|
||||
if (!methodInstance->mIRFunction)
|
||||
|
@ -26101,6 +26116,15 @@ bool BfModule::SlotVirtualMethod(BfMethodInstance* methodInstance, BfAmbiguityCo
|
|||
continue;
|
||||
}
|
||||
|
||||
if (iMethodIdx >= ifaceInst->mMethodInstanceGroups.mSize)
|
||||
PopulateType(ifaceInst, BfPopulateType_DataAndMethods);
|
||||
|
||||
if (iMethodIdx >= ifaceInst->mMethodInstanceGroups.mSize)
|
||||
{
|
||||
InternalError("Interface slotting error", methodInstance->mMethodDef->GetMutNode());
|
||||
break;
|
||||
}
|
||||
|
||||
auto& iMethodGroup = ifaceInst->mMethodInstanceGroups[iMethodIdx];
|
||||
auto iMethodInst = iMethodGroup.mDefault;
|
||||
if (iMethodInst == NULL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue