Browse Source

Fix incorrect display of constructors in tree view.

pull/1213/head
Siegfried Pammer 7 years ago
parent
commit
23f118ac93
  1. 20
      ILSpy/Languages/CSharpLanguage.cs
  2. 6
      ILSpy/Languages/Language.cs

20
ILSpy/Languages/CSharpLanguage.cs

@ -502,18 +502,18 @@ namespace ICSharpCode.ILSpy
if (method == null) if (method == null)
throw new ArgumentNullException(nameof(method)); throw new ArgumentNullException(nameof(method));
string name; string name;
if (includeDeclaringTypeName) {
name = TypeToString(method.DeclaringTypeDefinition, includeNamespace: includeNamespaceOfDeclaringTypeName) + ".";
} else {
name = "";
}
if (method.IsConstructor) { if (method.IsConstructor) {
name = TypeToString(method.DeclaringTypeDefinition, includeNamespace: includeNamespaceOfDeclaringTypeName); name += TypeToString(method.DeclaringTypeDefinition, false);
} else { } else {
if (includeDeclaringTypeName) {
name = TypeToString(method.DeclaringTypeDefinition, includeNamespace: includeNamespaceOfDeclaringTypeName) + ".";
} else {
name = "";
}
name += method.Name; name += method.Name;
} }
int i = 0; int i = 0;
var buffer = new System.Text.StringBuilder(name); var buffer = new StringBuilder(name);
if (method.TypeParameters.Count > 0) { if (method.TypeParameters.Count > 0) {
buffer.Append('<'); buffer.Append('<');
@ -537,8 +537,10 @@ namespace ICSharpCode.ILSpy
} }
buffer.Append(')'); buffer.Append(')');
buffer.Append(" : "); if (!method.IsConstructor) {
buffer.Append(TypeToStringInternal(method.ReturnType, includeNamespace)); buffer.Append(" : ");
buffer.Append(TypeToStringInternal(method.ReturnType, includeNamespace));
}
return buffer.ToString(); return buffer.ToString();
} }

6
ILSpy/Languages/Language.cs

@ -221,8 +221,10 @@ namespace ICSharpCode.ILSpy
i++; i++;
} }
buffer.Append(')'); buffer.Append(')');
buffer.Append(" : "); if (!method.IsConstructor) {
buffer.Append(TypeToString(method.ReturnType, includeNamespace)); buffer.Append(" : ");
buffer.Append(TypeToString(method.ReturnType, includeNamespace));
}
return buffer.ToString(); return buffer.ToString();
} }

Loading…
Cancel
Save