Browse Source

Fixed parsing of switch statements.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
578bb6c062
  1. 4
      ICSharpCode.NRefactory.CSharp/Parser/CSharpParser.cs

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

@ -1662,8 +1662,10 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1662,8 +1662,10 @@ namespace ICSharpCode.NRefactory.CSharp
result.AddChild (new CSharpTokenNode (Convert (location [1]), 1), SwitchStatement.Roles.RPar);
if (location != null && location.Count > 2)
result.AddChild (new CSharpTokenNode (Convert (location [2]), 1), SwitchStatement.Roles.LBrace);
if (switchStatement.Sections != null) {
foreach (var section in switchStatement.Sections) {
var newSection = new SwitchSection ();
if (section.Labels != null) {
foreach (var caseLabel in section.Labels) {
var newLabel = new CaseLabel ();
if (caseLabel.Label != null) {
@ -1678,6 +1680,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1678,6 +1680,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
newSection.AddChild (newLabel, SwitchSection.CaseLabelRole);
}
}
var blockStatement = section.Block;
var bodyBlock = new BlockStatement ();
@ -1690,6 +1693,7 @@ namespace ICSharpCode.NRefactory.CSharp @@ -1690,6 +1693,7 @@ namespace ICSharpCode.NRefactory.CSharp
}
result.AddChild (newSection, SwitchStatement.SwitchSectionRole);
}
}
if (location != null && location.Count > 3) {
result.AddChild (new CSharpTokenNode (Convert (location [3]), 1), SwitchStatement.Roles.RBrace);

Loading…
Cancel
Save