Browse Source

Fix #1008: Empty decompiled code for a constructor

pull/1012/head
Siegfried Pammer 8 years ago
parent
commit
73081e8781
  1. 2
      ICSharpCode.Decompiler/CSharp/Transforms/ConvertConstructorCallIntoInitializer.cs

2
ICSharpCode.Decompiler/CSharp/Transforms/ConvertConstructorCallIntoInitializer.cs

@ -161,7 +161,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms @@ -161,7 +161,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
{
if (contextTypeDefinition == null) return;
var instanceCtors = members.OfType<ConstructorDeclaration>().Where(c => (c.Modifiers & Modifiers.Static) == 0).ToArray();
if (instanceCtors.Length == 1) {
if (instanceCtors.Length == 1 && members.Skip(1).Any()) {
ConstructorDeclaration emptyCtor = new ConstructorDeclaration();
emptyCtor.Modifiers = contextTypeDefinition.IsAbstract ? Modifiers.Protected : Modifiers.Public;
emptyCtor.Body = new BlockStatement();

Loading…
Cancel
Save