Browse Source

[Parser] Set locations of AttributeSections correctly.

newNRvisualizers
Simon Lindgren 13 years ago
parent
commit
7c19dfa4ef
  1. 8
      ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs

8
ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs

@ -335,12 +335,16 @@ namespace ICSharpCode.NRefactory.CSharp @@ -335,12 +335,16 @@ namespace ICSharpCode.NRefactory.CSharp
if (loc != null && pos < loc.Count)
result.AddChild (new CSharpTokenNode (Convert (loc [pos++])), Roles.Colon);
}
int attributeCount = 0;
foreach (var attr in GetAttributes (optAttributes)) {
result.AddChild (attr, Roles.Attribute);
attributeCount++;
}
// Left and right bracket + commas between the attributes
int locCount = 2 + attributeCount - 1;
// optional comma
if (loc != null && pos < loc.Count - 1 && !loc [pos].Equals (loc [pos + 1]))
if (loc != null && pos < loc.Count - 1 && loc.Count == locCount + 1)
result.AddChild (new CSharpTokenNode (Convert (loc [pos++])), Roles.Comma);
if (loc != null && pos < loc.Count)
result.AddChild (new CSharpTokenNode (Convert (loc [pos++])), Roles.RBracket);

Loading…
Cancel
Save