Browse Source

Fix bug in TSAB: readonly and ref modifiers should only be added to structs if ShowModifiers == true.

pull/1253/head
Siegfried Pammer 7 years ago
parent
commit
bb38046e8b
  1. 2
      ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs

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

@ -1016,12 +1016,14 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
case TypeKind.Struct: case TypeKind.Struct:
classType = ClassType.Struct; classType = ClassType.Struct;
modifiers &= ~Modifiers.Sealed; modifiers &= ~Modifiers.Sealed;
if (ShowModifiers) {
if (typeDefinition.IsReadOnly) { if (typeDefinition.IsReadOnly) {
modifiers |= Modifiers.Readonly; modifiers |= Modifiers.Readonly;
} }
if (typeDefinition.IsByRefLike) { if (typeDefinition.IsByRefLike) {
modifiers |= Modifiers.Ref; modifiers |= Modifiers.Ref;
} }
}
break; break;
case TypeKind.Enum: case TypeKind.Enum:
classType = ClassType.Enum; classType = ClassType.Enum;

Loading…
Cancel
Save