Browse Source

Merge pull request #1835 from yyjdelete/void-struct

Display System.Void as struct
pull/1843/head
Siegfried Pammer 6 years ago committed by GitHub
parent
commit
31fe4f7fa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs
  2. 1
      ILSpy/TreeNodes/TypeTreeNode.cs

3
ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs

@ -1362,6 +1362,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
ClassType classType; ClassType classType;
switch (typeDefinition.Kind) { switch (typeDefinition.Kind) {
case TypeKind.Struct: case TypeKind.Struct:
case TypeKind.Void:
classType = ClassType.Struct; classType = ClassType.Struct;
modifiers &= ~Modifiers.Sealed; modifiers &= ~Modifiers.Sealed;
if (ShowModifiers) { if (ShowModifiers) {
@ -1420,7 +1421,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
decl.BaseTypes.Add(ConvertType(typeDefinition.EnumUnderlyingType)); decl.BaseTypes.Add(ConvertType(typeDefinition.EnumUnderlyingType));
} }
// if the declared type is a struct, ignore System.ValueType // if the declared type is a struct, ignore System.ValueType
} else if (typeDefinition.Kind == TypeKind.Struct && baseType.IsKnownType(KnownTypeCode.ValueType)) { } else if ((typeDefinition.Kind == TypeKind.Struct || typeDefinition.Kind == TypeKind.Void) && baseType.IsKnownType(KnownTypeCode.ValueType)) {
continue; continue;
// always ignore System.Object // always ignore System.Object
} else if (baseType.IsKnownType(KnownTypeCode.Object)) { } else if (baseType.IsKnownType(KnownTypeCode.Object)) {

1
ILSpy/TreeNodes/TypeTreeNode.cs

@ -122,6 +122,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
case TypeKind.Interface: case TypeKind.Interface:
return TypeIcon.Interface; return TypeIcon.Interface;
case TypeKind.Struct: case TypeKind.Struct:
case TypeKind.Void:
return TypeIcon.Struct; return TypeIcon.Struct;
case TypeKind.Delegate: case TypeKind.Delegate:
return TypeIcon.Delegate; return TypeIcon.Delegate;

Loading…
Cancel
Save