1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Fixed virtuals defaults issue, added virtuals test

This commit is contained in:
Brian Fiete 2020-02-21 06:08:59 -08:00
parent 40c404f329
commit 5d1a9e6873
4 changed files with 68 additions and 9 deletions

View file

@ -4289,9 +4289,19 @@ BfTypedValue BfExprEvaluator::CreateCall(BfMethodInstance* methodInstance, BfIRV
}
if (methodInstance->mVirtualTableIdx != -1)
{
{
if ((!bypassVirtual) && (mDeferCallRef == NULL))
{
if ((methodDef->mIsOverride) && (mModule->mCurMethodInstance->mIsReified))
{
// Ensure that declaring method gets referenced
auto typeInstance = methodInstance->GetOwner();
auto& vEntry = typeInstance->mVirtualMethodTable[methodInstance->mVirtualTableIdx];
BfMethodInstance* declaringMethodInstance = vEntry.mDeclaringMethod;
if ((declaringMethodInstance->mMethodInstanceGroup->mOnDemandKind < BfMethodOnDemandKind_InWorkList) || (!methodInstance->mIsReified))
mModule->GetMethodInstance(declaringMethodInstance);
}
auto funcType = mModule->mBfIRBuilder->MapMethod(methodInstance);
auto funcPtrType1 = mModule->mBfIRBuilder->GetPointerTo(funcType);
auto funcPtrType2 = mModule->mBfIRBuilder->GetPointerTo(funcPtrType1);