Browse Source

More efficient/correct test for static class icon

pull/170/head
Ed Harvey 15 years ago
parent
commit
e7caa3f43f
  1. 30
      ILSpy/TreeNodes/TypeTreeNode.cs

30
ILSpy/TreeNodes/TypeTreeNode.cs

@ -42,28 +42,35 @@ namespace ICSharpCode.ILSpy.TreeNodes
this.LazyLoading = true; this.LazyLoading = true;
} }
public TypeDefinition TypeDefinition { public TypeDefinition TypeDefinition
{
get { return type; } get { return type; }
} }
public AssemblyTreeNode ParentAssemblyNode { public AssemblyTreeNode ParentAssemblyNode
{
get { return parentAssemblyNode; } get { return parentAssemblyNode; }
} }
public string Name { public string Name
{
get { return type.Name; } get { return type.Name; }
} }
public string Namespace { public string Namespace
{
get { return type.Namespace; } get { return type.Namespace; }
} }
public override object Text { public override object Text
{
get { return HighlightSearchMatch(this.Language.TypeToString(type, includeNamespace: false)); } get { return HighlightSearchMatch(this.Language.TypeToString(type, includeNamespace: false)); }
} }
public bool IsPublicAPI { public bool IsPublicAPI
get { {
get
{
switch (type.Attributes & TypeAttributes.VisibilityMask) { switch (type.Attributes & TypeAttributes.VisibilityMask) {
case TypeAttributes.Public: case TypeAttributes.Public:
case TypeAttributes.NestedPublic: case TypeAttributes.NestedPublic:
@ -188,15 +195,20 @@ namespace ICSharpCode.ILSpy.TreeNodes
private static bool IsStaticClass(TypeDefinition type) private static bool IsStaticClass(TypeDefinition type)
{ {
if(type.IsSealed) if (type.IsSealed) {
if (type.IsAbstract)
return true;
else
return !type.Methods.Where(m => m.Name == ".ctor").Any(m => !m.IsPrivate); return !type.Methods.Where(m => m.Name == ".ctor").Any(m => !m.IsPrivate);
}
return false; return false;
} }
#endregion #endregion
MemberReference IMemberTreeNode.Member { MemberReference IMemberTreeNode.Member
{
get { return type; } get { return type; }
} }
} }

Loading…
Cancel
Save