Browse Source

No longer add empty attribute sections.

pull/45/merge
Mike Krüger 12 years ago
parent
commit
8e8aaf1ef6
  1. 7
      ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs

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

@ -328,7 +328,6 @@ namespace ICSharpCode.NRefactory.CSharp @@ -328,7 +328,6 @@ namespace ICSharpCode.NRefactory.CSharp
AttributeSection ConvertAttributeSection (IEnumerable<Mono.CSharp.Attribute> optAttributes)
{
if (optAttributes == null)
return null;
AttributeSection result = new AttributeSection ();
@ -357,6 +356,8 @@ namespace ICSharpCode.NRefactory.CSharp @@ -357,6 +356,8 @@ namespace ICSharpCode.NRefactory.CSharp
attributeCount++;
}
if (attributeCount == 0)
return null;
// Left and right bracket + commas between the attributes
int locCount = 2 + attributeCount - 1;
// optional comma
@ -956,7 +957,9 @@ namespace ICSharpCode.NRefactory.CSharp @@ -956,7 +957,9 @@ namespace ICSharpCode.NRefactory.CSharp
if (attrs == null)
return;
foreach (var attr in attrs.Sections) {
parent.AddChild (ConvertAttributeSection (attr), role);
var section = ConvertAttributeSection(attr);
if (section != null)
parent.AddChild (section, role);
}
}

Loading…
Cancel
Save