Browse Source

Fix #600: variable called int should be displayed as @int

pull/626/merge
Daniel Grunwald 10 years ago
parent
commit
75dfa785d7
  1. 4
      ICSharpCode.Decompiler/Ast/TextTokenWriter.cs
  2. 2
      NRefactory/ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpOutputVisitor.cs

4
ICSharpCode.Decompiler/Ast/TextTokenWriter.cs

@ -53,6 +53,10 @@ namespace ICSharpCode.Decompiler.Ast @@ -53,6 +53,10 @@ namespace ICSharpCode.Decompiler.Ast
public override void WriteIdentifier(Identifier identifier)
{
if (identifier.IsVerbatim || CSharpOutputVisitor.IsKeyword(identifier.Name, identifier)) {
output.Write('@');
}
var definition = GetCurrentDefinition();
if (definition != null) {
output.WriteDefinition(identifier.Name, definition, false);

2
NRefactory/ICSharpCode.NRefactory.CSharp/OutputVisitor/CSharpOutputVisitor.cs

@ -1158,7 +1158,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1158,7 +1158,7 @@ namespace ICSharpCode.NRefactory.CSharp
StartNode(attributeSection);
WriteToken(Roles.LBracket);
if (!string.IsNullOrEmpty(attributeSection.AttributeTarget)) {
WriteIdentifier(attributeSection.AttributeTargetToken);
WriteKeyword(attributeSection.AttributeTarget, Roles.Identifier);
WriteToken(Roles.Colon);
Space();
}

Loading…
Cancel
Save