From 6c5288b839a8c9125830c86df5f054477a7a6306 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Thu, 13 Sep 2012 13:20:24 +0200 Subject: [PATCH] Fixed TextOutputFormatter so that it calls WriteDefinition() for method declarations. --- ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs b/ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs index 5e3cef994..c43b0c7c2 100644 --- a/ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs +++ b/ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs @@ -150,13 +150,11 @@ namespace ICSharpCode.Decompiler.Ast return null; var node = nodeStack.Peek(); + if (node is Identifier) + node = node.Parent; if (IsDefinition(node)) return node.Annotation(); - var fieldDef = node.Parent.Annotation(); - if (fieldDef != null) - return node.Parent.Annotation(); - return null; } @@ -332,7 +330,9 @@ namespace ICSharpCode.Decompiler.Ast private static bool IsDefinition(AstNode node) { - return node is EntityDeclaration; + return node is EntityDeclaration + || (node is VariableInitializer && node.Parent is FieldDeclaration) + || node is FixedVariableInitializer; } } }