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

Include inner-overload method in classview

This commit is contained in:
Brian Fiete 2020-12-04 05:22:49 -08:00
parent a17b086bd4
commit 687dde063f
3 changed files with 42 additions and 14 deletions

View file

@ -62,7 +62,8 @@ namespace IDE.ui
case .Field, case .Field,
.Property: .Property:
IDEUtils.ColorizeCodeString(mLabel, .Field); IDEUtils.ColorizeCodeString(mLabel, .Field);
case .Method: case .Method,
.MethodOverride:
IDEUtils.ColorizeCodeString(mLabel, .Method); IDEUtils.ColorizeCodeString(mLabel, .Method);
default: default:
} }
@ -109,7 +110,8 @@ namespace IDE.ui
icon = DarkTheme.sDarkTheme.GetImage(.Field); icon = DarkTheme.sDarkTheme.GetImage(.Field);
case .Property: case .Property:
icon = DarkTheme.sDarkTheme.GetImage(.Property); icon = DarkTheme.sDarkTheme.GetImage(.Property);
case .Method: case .Method,
.MethodOverride:
icon = DarkTheme.sDarkTheme.GetImage(.Method); icon = DarkTheme.sDarkTheme.GetImage(.Method);
default: default:
} }
@ -319,7 +321,8 @@ namespace IDE.ui
Field, Field,
Property, Property,
Method Method,
MethodOverride,
} }
class PendingInfo class PendingInfo
@ -764,6 +767,7 @@ namespace IDE.ui
case 'F': kind = .Field; case 'F': kind = .Field;
case 'P': kind = .Property; case 'P': kind = .Property;
case 'M': kind = .Method; case 'M': kind = .Method;
case 'o': kind = .MethodOverride;
} }
var itr = param.Split('\t'); var itr = param.Split('\t');
let entry = mPendingInfo.mPendingRoot.AddChild(kind, scope String()..Reference(itr.GetNext().Get())); let entry = mPendingInfo.mPendingRoot.AddChild(kind, scope String()..Reference(itr.GetNext().Get()));

View file

@ -8241,6 +8241,9 @@ String BfCompiler::GetTypeDefMatches(const StringImpl& searchStr)
matchHelper.ClearResults(); matchHelper.ClearResults();
if (matchHelper.CheckMemberMatch(typeDef, methodDef->mName)) if (matchHelper.CheckMemberMatch(typeDef, methodDef->mName))
{ {
if (methodDef->mIsOverride)
result += "o";
else
result += "M"; result += "M";
if (BfTypeUtils::TypeToString(result, typeDef, (BfTypeNameFlags)(BfTypeNameFlag_HideGlobalName | BfTypeNameFlag_InternalName))) if (BfTypeUtils::TypeToString(result, typeDef, (BfTypeNameFlags)(BfTypeNameFlag_HideGlobalName | BfTypeNameFlag_InternalName)))
result += "."; result += ".";

View file

@ -20724,6 +20724,8 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
if (methodDef->mIsOverride) if (methodDef->mIsOverride)
{ {
bool found = false;
for (int virtIdx = 0; virtIdx < (int)typeInstance->mVirtualMethodTable.size(); virtIdx++) for (int virtIdx = 0; virtIdx < (int)typeInstance->mVirtualMethodTable.size(); virtIdx++)
{ {
auto& ventry = typeInstance->mVirtualMethodTable[virtIdx]; auto& ventry = typeInstance->mVirtualMethodTable[virtIdx];
@ -20742,6 +20744,7 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
auto baseType = typeInstance->mBaseType; auto baseType = typeInstance->mBaseType;
if (baseType != NULL) if (baseType != NULL)
{ {
found = true;
while ((baseType->mBaseType != NULL) && (virtIdx < baseType->mBaseType->mVirtualMethodTableSize)) while ((baseType->mBaseType != NULL) && (virtIdx < baseType->mBaseType->mVirtualMethodTableSize))
baseType = baseType->mBaseType; baseType = baseType->mBaseType;
BfMethodInstance* baseVirtMethod = baseType->mVirtualMethodTable[virtIdx].mImplementingMethod; BfMethodInstance* baseVirtMethod = baseType->mVirtualMethodTable[virtIdx].mImplementingMethod;
@ -20755,6 +20758,24 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
} }
} }
} }
if ((!found) && (autoComplete->mIsGetDefinition) && (methodDef->mDeclaringType->IsExtension()))
{
for (auto& methodGroup : typeInstance->mMethodInstanceGroups)
{
auto defaultMethod = methodGroup.mDefault;
if (defaultMethod == NULL)
continue;
if (!defaultMethod->mMethodDef->mIsExtern)
continue;
if (!CompareMethodSignatures(defaultMethod, methodInstance))
continue;
autoComplete->SetDefinitionLocation(defaultMethod->mMethodDef->GetRefNode(), true);
autoComplete->mDefType = typeInstance->mTypeDef;
autoComplete->mDefMethod = defaultMethod->mMethodDef;
}
}
} }
} }
} }