| Index: lib/compiler/implementation/tree/unparser.dart
|
| diff --git a/lib/compiler/implementation/tree/unparser.dart b/lib/compiler/implementation/tree/unparser.dart
|
| index 17852756cf2781af25b2609512899147492ac7cb..d48774e9a91761c6792a8cdbc9077bc6ea90d3f4 100644
|
| --- a/lib/compiler/implementation/tree/unparser.dart
|
| +++ b/lib/compiler/implementation/tree/unparser.dart
|
| @@ -347,14 +347,26 @@ class Unparser implements Visitor {
|
| }
|
|
|
| visitSwitchCase(SwitchCase node) {
|
| - if (node.label !== null) {
|
| - visit(node.label);
|
| - sb.add(': ');
|
| + Link<Label> labels = node.labels.nodes;
|
| + Link<CaseMatch> cases = node.cases.nodes;
|
| + // Interleave labels and cases in their original order.
|
| + while (!labels.isEmpty()) {
|
| + Label label = labels.head;
|
| + while (!cases.isEmpty()) {
|
| + CaseMatch match = cases.head;
|
| + if (match.colonToken.charOffset < label.colonToken.charOffset) {
|
| + visit(match);
|
| + cases = cases.tail;
|
| + } else {
|
| + break;
|
| + }
|
| + }
|
| + visit(label);
|
| + labels = labels.tail;
|
| }
|
| - for (Expression expression in node.expressions) {
|
| - sb.add('case ');
|
| - visit(expression);
|
| - sb.add(': ');
|
| + while (!cases.isEmpty()) {
|
| + visit(cases.head);
|
| + cases = cases.tail;
|
| }
|
| if (node.isDefaultCase) {
|
| sb.add('default:');
|
| @@ -389,6 +401,13 @@ class Unparser implements Visitor {
|
| }
|
| }
|
|
|
| + visitCaseMatch(CaseMatch node) {
|
| + add(node.caseKeyword.value);
|
| + sb.add(" ");
|
| + visit(node.expression);
|
| + add(node.colonToken.value);
|
| + }
|
| +
|
| visitCatchBlock(CatchBlock node) {
|
| add(node.catchKeyword.value);
|
| sb.add(' ');
|
|
|