|
|
|
|
@ -1659,11 +1659,13 @@ namespace ICSharpCode.NRefactory.CSharp
@@ -1659,11 +1659,13 @@ namespace ICSharpCode.NRefactory.CSharp
|
|
|
|
|
if (switchStatement.Expr != null) |
|
|
|
|
result.AddChild ((Expression)switchStatement.Expr.Accept (this), SwitchStatement.Roles.Expression); |
|
|
|
|
if (location != null && location.Count > 1) |
|
|
|
|
result.AddChild (new CSharpTokenNode (Convert (location[1]), 1), SwitchStatement.Roles.RPar); |
|
|
|
|
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); |
|
|
|
|
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,9 +1693,10 @@ namespace ICSharpCode.NRefactory.CSharp
@@ -1690,9 +1693,10 @@ 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); |
|
|
|
|
result.AddChild (new CSharpTokenNode (Convert (location [3]), 1), SwitchStatement.Roles.RBrace); |
|
|
|
|
} else { |
|
|
|
|
// parser error, set end node to max value.
|
|
|
|
|
result.AddChild (new ErrorNode (), AstNode.Roles.Error); |
|
|
|
|
|