mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Merge pull request #2184 from Fusioon/fix-#1883
Fix inherited properties on interface
This commit is contained in:
commit
19eb1f22a8
1 changed files with 24 additions and 2 deletions
|
@ -5891,6 +5891,7 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
|
|||
flags = (BfLookupFieldFlags)(flags | BfLookupFieldFlag_IsFailurePass);
|
||||
|
||||
bool isBaseLookup = false;
|
||||
int checkInterfaceIdx = 0;
|
||||
while (curCheckType != NULL)
|
||||
{
|
||||
if (((flags & BfLookupFieldFlag_CheckingOuter) != 0) && ((mBfEvalExprFlags & BfEvalExprFlags_Comptime) != 0))
|
||||
|
@ -6248,10 +6249,18 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
|
|||
}
|
||||
}
|
||||
|
||||
if ((!isBaseLookup) && (startCheckType->IsInterface() && (checkInterfaceIdx < (int)startCheckType->mInterfaces.size())))
|
||||
{
|
||||
curCheckType = startCheckType->mInterfaces[checkInterfaceIdx].mInterfaceType;
|
||||
checkInterfaceIdx++;
|
||||
}
|
||||
else
|
||||
{
|
||||
isBaseLookup = true;
|
||||
curCheckType = curCheckType->mBaseType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto outerTypeDef = mModule->GetOuterType(startCheckType);
|
||||
if (outerTypeDef != NULL)
|
||||
|
@ -19924,6 +19933,19 @@ BfModuleMethodInstance BfExprEvaluator::GetPropertyMethodInstance(BfMethodDef* m
|
|||
|
||||
if (bestIFaceEntry != NULL)
|
||||
{
|
||||
if ((checkTypeInst->IsInterface()))
|
||||
{
|
||||
auto propTypeInst = bestIFaceEntry->mInterfaceType->ToTypeInstance();
|
||||
if (propTypeInst == NULL)
|
||||
{
|
||||
mModule->Fail("INTERNAL ERROR: Invalid property target", mPropSrc);
|
||||
return BfModuleMethodInstance();
|
||||
}
|
||||
BF_ASSERT(propTypeInst->mTypeDef->mFullNameEx == methodDef->mDeclaringType->mFullNameEx);
|
||||
|
||||
return mModule->GetMethodInstance(propTypeInst, methodDef, BfTypeVector(), mPropGetMethodFlags);
|
||||
}
|
||||
|
||||
auto ifaceMethodEntry = checkTypeInst->mInterfaceMethodTable[bestIFaceEntry->mStartInterfaceTableIdx + methodDef->mIdx];
|
||||
BfMethodInstance* bestMethodInstance = ifaceMethodEntry.mMethodRef;
|
||||
if (bestMethodInstance != NULL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue