Browse Source

CalculateFitness: In case of ctors use type name.

pull/925/merge
Siegfried Pammer 8 years ago
parent
commit
024abb3ba6
  1. 12
      ILSpy/SearchStrategies.cs

12
ILSpy/SearchStrategies.cs

@ -39,16 +39,20 @@ namespace ICSharpCode.ILSpy
protected float CalculateFitness(MemberReference member, string text) protected float CalculateFitness(MemberReference member, string text)
{ {
// Probably compiler generated types without meaningful names, show them last // Probably compiler generated types without meaningful names, show them last
if (text.StartsWith("<")) if (text.StartsWith("<")) {
{
return 0; return 0;
} }
// Constructors always have the same name in IL:
// Use type name instead
if (text == "..ctor" || text == ".ctor") {
text = member.DeclaringType.Name;
}
// Ignore generic arguments, it not possible to search based on them either // Ignore generic arguments, it not possible to search based on them either
int length = 0; int length = 0;
int generics = 0; int generics = 0;
for (int i = 0; i < text.Length; i++) for (int i = 0; i < text.Length; i++) {
{
if (text[i] == '<') if (text[i] == '<')
generics++; generics++;
else if (text[i] == '>') else if (text[i] == '>')

Loading…
Cancel
Save