mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Added extern method override support in extensions
This commit is contained in:
parent
1e020dc14e
commit
101fde1a4b
8 changed files with 99 additions and 35 deletions
|
@ -5319,6 +5319,8 @@ void BfCompiler::PopulateReified()
|
|||
// If we have chained methods, make sure we implement the chain members if the chain head is implemented and reified
|
||||
if (typeInst->mTypeDef->mIsCombinedPartial)
|
||||
{
|
||||
typeInst->mTypeDef->PopulateMemberSets();
|
||||
|
||||
bool hasUnimpChainMembers = false;
|
||||
|
||||
impChainHeadMethods.Clear();
|
||||
|
@ -5342,6 +5344,35 @@ void BfCompiler::PopulateReified()
|
|||
if (!methodInstance->IsReifiedAndImplemented())
|
||||
hasUnimpChainMembers = true;
|
||||
}
|
||||
else if (methodInstance->mIsInnerOverride)
|
||||
{
|
||||
if (!methodInstance->IsReifiedAndImplemented())
|
||||
{
|
||||
bool forceMethod = false;
|
||||
|
||||
BfMemberSetEntry* memberSetEntry;
|
||||
if (typeInst->mTypeDef->mMethodSet.TryGetWith((StringImpl&)methodInstance->mMethodDef->mName, &memberSetEntry))
|
||||
{
|
||||
BfMethodDef* checkMethodDef = (BfMethodDef*)memberSetEntry->mMemberDef;
|
||||
while (checkMethodDef != NULL)
|
||||
{
|
||||
auto& checkMethodInstanceGroup = typeInst->mMethodInstanceGroups[checkMethodDef->mIdx];
|
||||
auto checkMethodInstance = checkMethodInstanceGroup.mDefault;
|
||||
if (checkMethodInstance == NULL)
|
||||
continue;
|
||||
if ((checkMethodDef->mIsExtern) && (checkMethodInstance->IsReifiedAndImplemented()))
|
||||
forceMethod = true;
|
||||
checkMethodDef = checkMethodDef->mNextWithSameName;
|
||||
}
|
||||
}
|
||||
|
||||
if (forceMethod)
|
||||
{
|
||||
typeInst->mModule->GetMethodInstance(methodInstance->GetOwner(), methodInstance->mMethodDef, BfTypeVector(),
|
||||
(BfGetMethodInstanceFlags)(BfGetMethodInstanceFlag_UnspecializedPass));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((hasUnimpChainMembers) && (!impChainHeadMethods.IsEmpty()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue