mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Fix inherited properties on interface
This commit is contained in:
parent
9c79d8aa6c
commit
410a6ead6a
1 changed files with 24 additions and 2 deletions
|
@ -5886,6 +5886,7 @@ BfTypedValue BfExprEvaluator::LookupField(BfAstNode* targetSrc, BfTypedValue tar
|
||||||
flags = (BfLookupFieldFlags)(flags | BfLookupFieldFlag_IsFailurePass);
|
flags = (BfLookupFieldFlags)(flags | BfLookupFieldFlag_IsFailurePass);
|
||||||
|
|
||||||
bool isBaseLookup = false;
|
bool isBaseLookup = false;
|
||||||
|
int checkInterfaceIdx = 0;
|
||||||
while (curCheckType != NULL)
|
while (curCheckType != NULL)
|
||||||
{
|
{
|
||||||
if (((flags & BfLookupFieldFlag_CheckingOuter) != 0) && ((mBfEvalExprFlags & BfEvalExprFlags_Comptime) != 0))
|
if (((flags & BfLookupFieldFlag_CheckingOuter) != 0) && ((mBfEvalExprFlags & BfEvalExprFlags_Comptime) != 0))
|
||||||
|
@ -6243,10 +6244,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;
|
isBaseLookup = true;
|
||||||
curCheckType = curCheckType->mBaseType;
|
curCheckType = curCheckType->mBaseType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto outerTypeDef = mModule->GetOuterType(startCheckType);
|
auto outerTypeDef = mModule->GetOuterType(startCheckType);
|
||||||
if (outerTypeDef != NULL)
|
if (outerTypeDef != NULL)
|
||||||
|
@ -19919,6 +19928,19 @@ BfModuleMethodInstance BfExprEvaluator::GetPropertyMethodInstance(BfMethodDef* m
|
||||||
|
|
||||||
if (bestIFaceEntry != NULL)
|
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];
|
auto ifaceMethodEntry = checkTypeInst->mInterfaceMethodTable[bestIFaceEntry->mStartInterfaceTableIdx + methodDef->mIdx];
|
||||||
BfMethodInstance* bestMethodInstance = ifaceMethodEntry.mMethodRef;
|
BfMethodInstance* bestMethodInstance = ifaceMethodEntry.mMethodRef;
|
||||||
if (bestMethodInstance != NULL)
|
if (bestMethodInstance != NULL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue