Browse Source

Fix initialization order of destructorBodyPattern and destructorPattern.

pull/1253/head
Siegfried Pammer 7 years ago
parent
commit
d469edbf2a
  1. 18
      ICSharpCode.Decompiler/CSharp/Transforms/PatternStatementTransform.cs

18
ICSharpCode.Decompiler/CSharp/Transforms/PatternStatementTransform.cs

@ -810,16 +810,8 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms @@ -810,16 +810,8 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
return ed;
}
#endregion
#region Destructor
static readonly MethodDeclaration destructorPattern = new MethodDeclaration {
Attributes = { new Repeat(new AnyNode()) },
Modifiers = Modifiers.Any,
ReturnType = new PrimitiveType("void"),
Name = "Finalize",
Body = destructorBodyPattern
};
#region Destructor
static readonly BlockStatement destructorBodyPattern = new BlockStatement {
new TryCatchStatement {
TryBlock = new AnyNode("body"),
@ -829,6 +821,14 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms @@ -829,6 +821,14 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
}
};
static readonly MethodDeclaration destructorPattern = new MethodDeclaration {
Attributes = { new Repeat(new AnyNode()) },
Modifiers = Modifiers.Any,
ReturnType = new PrimitiveType("void"),
Name = "Finalize",
Body = destructorBodyPattern
};
DestructorDeclaration TransformDestructor(MethodDeclaration methodDef)
{
Match m = destructorPattern.Match(methodDef);

Loading…
Cancel
Save