Browse Source

Fix #220: Link constructor calls to constructor rather than type + add link for base constructor calls

pull/398/head
Ronny Klier 12 years ago
parent
commit
b4e8386611
  1. 9
      ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs

9
ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs

@ -84,7 +84,9 @@ namespace ICSharpCode.Decompiler.Ast @@ -84,7 +84,9 @@ namespace ICSharpCode.Decompiler.Ast
{
AstNode node = nodeStack.Peek();
MemberReference memberRef = node.Annotation<MemberReference>();
if (memberRef == null && node.Role == Roles.TargetExpression && (node.Parent is InvocationExpression || node.Parent is ObjectCreateExpression)) {
if ((node.Parent is ObjectCreateExpression) ||
(memberRef == null && node.Role == Roles.TargetExpression && node.Parent is InvocationExpression))
{
memberRef = node.Parent.Annotation<MemberReference>();
}
return memberRef;
@ -160,6 +162,11 @@ namespace ICSharpCode.Decompiler.Ast @@ -160,6 +162,11 @@ namespace ICSharpCode.Decompiler.Ast
public void WriteKeyword(string keyword)
{
MemberReference memberRef = GetCurrentMemberReference();
var node = nodeStack.Peek();
if (memberRef != null && node is ConstructorInitializer)
output.WriteReference(keyword, memberRef);
else
output.Write(keyword);
}

Loading…
Cancel
Save