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; } } }