1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-12 13:24:09 +02:00

Improved Find All References handling of virtual method overrides

This commit is contained in:
Brian Fiete 2022-06-16 11:17:01 -07:00
parent 5c59fe694d
commit eeed1bf41c

View file

@ -9998,7 +9998,14 @@ BfTypedValue BfExprEvaluator::MatchMethod(BfAstNode* targetSrc, BfMethodBoundExp
if ((identifierNode != NULL) && (methodDef->mIdx >= 0) && (!isIndirectMethodCall) && if ((identifierNode != NULL) && (methodDef->mIdx >= 0) && (!isIndirectMethodCall) &&
((targetTypeInst == NULL) || (!targetTypeInst->IsDelegateOrFunction()))) ((targetTypeInst == NULL) || (!targetTypeInst->IsDelegateOrFunction())))
{ {
mModule->mCompiler->mResolvePassData->HandleMethodReference(identifierNode, moduleMethodInstance.mMethodInstance->GetOwner()->mTypeDef, methodDef); auto refMethodInstance = moduleMethodInstance.mMethodInstance;
if (refMethodInstance->mVirtualTableIdx != -1)
{
auto& virtualEntry = refMethodInstance->GetOwner()->mVirtualMethodTable[refMethodInstance->mVirtualTableIdx];
refMethodInstance = virtualEntry.mDeclaringMethod;
}
mModule->mCompiler->mResolvePassData->HandleMethodReference(identifierNode, refMethodInstance->GetOwner()->mTypeDef, refMethodInstance->mMethodDef);
auto autoComplete = GetAutoComplete(); auto autoComplete = GetAutoComplete();
if ((autoComplete != NULL) && (autoComplete->IsAutocompleteNode(identifierNode))) if ((autoComplete != NULL) && (autoComplete->IsAutocompleteNode(identifierNode)))
{ {
@ -10026,8 +10033,8 @@ BfTypedValue BfExprEvaluator::MatchMethod(BfAstNode* targetSrc, BfMethodBoundExp
if (autoComplete->mDefType == NULL) if (autoComplete->mDefType == NULL)
{ {
autoComplete->mDefMethod = methodDef; autoComplete->mDefMethod = refMethodInstance->mMethodDef;
autoComplete->mDefType = moduleMethodInstance.mMethodInstance->GetOwner()->mTypeDef; autoComplete->mDefType = refMethodInstance->GetOwner()->mTypeDef;
} }
if (autoComplete->mResolveType == BfResolveType_GetResultString) if (autoComplete->mResolveType == BfResolveType_GetResultString)
@ -10721,8 +10728,8 @@ void BfExprEvaluator::LookupQualifiedStaticField(BfAstNode* nameNode, BfIdentifi
// Lookup left side as a type // Lookup left side as a type
{ {
BfType* type = mModule->ResolveTypeRef(nameLeft, NULL, BfPopulateType_Declaration, (BfResolveTypeRefFlags)(BfResolveTypeRefFlag_IgnoreLookupError | BfResolveTypeRefFlag_AllowGlobalContainer)); BfType* type = mModule->ResolveTypeRef(nameLeft, NULL, BfPopulateType_Declaration, (BfResolveTypeRefFlags)(BfResolveTypeRefFlag_IgnoreLookupError | BfResolveTypeRefFlag_AllowGlobalContainer));
if ((type != NULL) && (type->IsVar()) && (nameLeft->Equals("var"))) //if ((type != NULL) && (type->IsVar()) && (nameLeft->Equals("var")))
type = NULL; //type = NULL;
if (type != NULL) if (type != NULL)
{ {