Browse Source

Node text for cs/vb constructors

use type name rather than .ctor/,cctor
pull/724/head
Ed Harvey 9 years ago
parent
commit
e2e952a9be
  1. BIN
      ILSpy/Images/OverlayStatic.png
  2. 10
      ILSpy/Languages/CSharpLanguage.cs
  3. 9
      ILSpy/Languages/Language.cs
  4. 4
      ILSpy/TreeNodes/MethodTreeNode.cs
  5. 10
      ILSpy/VB/VBLanguage.cs

BIN
ILSpy/Images/OverlayStatic.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 315 B

After

Width:  |  Height:  |  Size: 347 B

10
ILSpy/Languages/CSharpLanguage.cs

@ -585,7 +585,15 @@ namespace ICSharpCode.ILSpy
} else } else
return property.Name; return property.Name;
} }
public override string FormatMethodName(MethodDefinition method)
{
if (method == null)
throw new ArgumentNullException("method");
return (method.IsConstructor) ? method.DeclaringType.Name : method.Name;
}
public override string FormatTypeName(TypeDefinition type) public override string FormatTypeName(TypeDefinition type)
{ {
if (type == null) if (type == null)

9
ILSpy/Languages/Language.cs

@ -138,7 +138,14 @@ namespace ICSharpCode.ILSpy
throw new ArgumentNullException("property"); throw new ArgumentNullException("property");
return property.Name; return property.Name;
} }
public virtual string FormatMethodName(MethodDefinition method)
{
if (method == null)
throw new ArgumentNullException("method");
return method.Name;
}
public virtual string FormatTypeName(TypeDefinition type) public virtual string FormatTypeName(TypeDefinition type)
{ {
if (type == null) if (type == null)

4
ILSpy/TreeNodes/MethodTreeNode.cs

@ -69,7 +69,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
b.Append(") : "); b.Append(") : ");
b.Append(language.TypeToString(method.ReturnType, false, method.MethodReturnType)); b.Append(language.TypeToString(method.ReturnType, false, method.MethodReturnType));
b.Append(method.MetadataToken.ToSuffixString()); b.Append(method.MetadataToken.ToSuffixString());
return HighlightSearchMatch(method.Name, b.ToString()); return HighlightSearchMatch(language.FormatMethodName(method), b.ToString());
} }
public override object Icon public override object Icon
@ -93,7 +93,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
if (method.IsSpecialName && if (method.IsSpecialName &&
(method.Name == ".ctor" || method.Name == ".cctor")) { (method.Name == ".ctor" || method.Name == ".cctor")) {
return Images.GetIcon(MemberIcon.Constructor, GetOverlayIcon(method.Attributes), false); return Images.GetIcon(MemberIcon.Constructor, GetOverlayIcon(method.Attributes), method.IsStatic);
} }
if (method.HasPInvokeInfo) if (method.HasPInvokeInfo)

10
ILSpy/VB/VBLanguage.cs

@ -401,7 +401,15 @@ namespace ICSharpCode.ILSpy.VB
Settings = settings Settings = settings
}); });
} }
public override string FormatMethodName(MethodDefinition method)
{
if (method == null)
throw new ArgumentNullException("method");
return (method.IsConstructor) ? method.DeclaringType.Name : method.Name;
}
public override string FormatTypeName(TypeDefinition type) public override string FormatTypeName(TypeDefinition type)
{ {
if (type == null) if (type == null)

Loading…
Cancel
Save