From db0c6a7086ebe2fcccd0e2db59a8a13fd02aef69 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Tue, 22 Feb 2011 18:19:16 +0100 Subject: [PATCH] Preserve annotations when declaring local variables. --- ICSharpCode.Decompiler/Ast/DeclareVariableInSmallestScope.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ICSharpCode.Decompiler/Ast/DeclareVariableInSmallestScope.cs b/ICSharpCode.Decompiler/Ast/DeclareVariableInSmallestScope.cs index ba60db563..af82e224d 100644 --- a/ICSharpCode.Decompiler/Ast/DeclareVariableInSmallestScope.cs +++ b/ICSharpCode.Decompiler/Ast/DeclareVariableInSmallestScope.cs @@ -34,6 +34,8 @@ namespace Decompiler Match m = assignmentPattern.Match(pos); if (m != null && m.Get("ident").Single().Identifier == name) { result = new VariableDeclarationStatement(type, name, m.Get("init").Single().Detach()); + result.Variables.Single().CopyAnnotationsFrom(((ExpressionStatement)pos).Expression); + result.CopyAnnotationsFrom(pos); pos.ReplaceWith(result); } else { result = new VariableDeclarationStatement(type, name);