Browse Source

Fix base constructor calls.

pull/1129/head
Daniel Grunwald 7 years ago
parent
commit
1df05e09e9
  1. 4
      ICSharpCode.Decompiler/CSharp/CallBuilder.cs

4
ICSharpCode.Decompiler/CSharp/CallBuilder.cs

@ -209,10 +209,12 @@ namespace ICSharpCode.Decompiler.CSharp @@ -209,10 +209,12 @@ namespace ICSharpCode.Decompiler.CSharp
} else {
if (method.IsStatic)
requireTarget = !expressionBuilder.IsCurrentOrContainingType(method.DeclaringTypeDefinition) || method.Name == ".cctor";
else if (method.Name == ".ctor")
requireTarget = true; // always use target for base/this-ctor-call, the constructor initializer pattern depends on this
else if (target.Expression is BaseReferenceExpression)
requireTarget = (callOpCode != OpCode.CallVirt && method.IsVirtual);
else
requireTarget = !(target.Expression is ThisReferenceExpression) || method.Name == ".ctor";
requireTarget = !(target.Expression is ThisReferenceExpression);
}
bool targetCasted = false;
bool argumentsCasted = false;

Loading…
Cancel
Save