From ae2824af99df3769041941fc940ccc4772d48b01 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 16 Mar 2019 00:09:44 +0100 Subject: [PATCH] Fix #617: Incorrect C# translation when `callvirt` is used to invoke base constructor --- .../TestCases/ILPretty/FSharpLoops_Debug.cs | 5 ----- .../TestCases/ILPretty/FSharpLoops_Release.cs | 5 ----- ICSharpCode.Decompiler/CSharp/CallBuilder.cs | 2 +- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/FSharpLoops_Debug.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/FSharpLoops_Debug.cs index 9f4c8ad77..f199ea1fd 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/FSharpLoops_Debug.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/FSharpLoops_Debug.cs @@ -36,11 +36,6 @@ public static class Program [CompilationMapping(SourceConstructFlags.Closure)] internal sealed class disposable_00403 : IDisposable { - public disposable_00403() - { - ((object)this)._002Ector(); - } - private void System_002DIDisposable_002DDispose() { } diff --git a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/FSharpLoops_Release.cs b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/FSharpLoops_Release.cs index 495722a13..bfadda404 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/FSharpLoops_Release.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/ILPretty/FSharpLoops_Release.cs @@ -37,11 +37,6 @@ public static class Program [CompilationMapping(SourceConstructFlags.Closure)] internal sealed class disposable_00403 : IDisposable { - public disposable_00403() - { - ((object)this)._002Ector(); - } - private void System_002DIDisposable_002DDispose() { } diff --git a/ICSharpCode.Decompiler/CSharp/CallBuilder.cs b/ICSharpCode.Decompiler/CSharp/CallBuilder.cs index 662123e43..61494fceb 100644 --- a/ICSharpCode.Decompiler/CSharp/CallBuilder.cs +++ b/ICSharpCode.Decompiler/CSharp/CallBuilder.cs @@ -187,7 +187,7 @@ namespace ICSharpCode.Decompiler.CSharp } else { target = expressionBuilder.TranslateTarget( callArguments.FirstOrDefault(), - nonVirtualInvocation: callOpCode == OpCode.Call, + nonVirtualInvocation: callOpCode == OpCode.Call || method.IsConstructor, memberStatic: method.IsStatic, memberDeclaringType: constrainedTo ?? method.DeclaringType); if (constrainedTo == null