Browse Source

Preserve annotations when declaring local variables.

pull/37/head
Daniel Grunwald 15 years ago
parent
commit
db0c6a7086
  1. 2
      ICSharpCode.Decompiler/Ast/DeclareVariableInSmallestScope.cs

2
ICSharpCode.Decompiler/Ast/DeclareVariableInSmallestScope.cs

@ -34,6 +34,8 @@ namespace Decompiler @@ -34,6 +34,8 @@ namespace Decompiler
Match m = assignmentPattern.Match(pos);
if (m != null && m.Get<IdentifierExpression>("ident").Single().Identifier == name) {
result = new VariableDeclarationStatement(type, name, m.Get<Expression>("init").Single().Detach());
result.Variables.Single().CopyAnnotationsFrom(((ExpressionStatement)pos).Expression);
result.CopyAnnotationsFrom(pos);
pos.ReplaceWith(result);
} else {
result = new VariableDeclarationStatement(type, name);

Loading…
Cancel
Save