| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 void simpleSwitch(e) { | 5 void simpleSwitch(e) { |
| 6 /*0@break*/ switch (e) { | 6 /*0@break*/ switch (e) { |
| 7 case 0: | 7 case 0: |
| 8 /*target=0*/ break; | 8 /*target=0*/ break; |
| 9 } | 9 } |
| 10 } | 10 } |
| 11 | 11 |
| 12 void simpleLabelledSwitch(e) { | 12 void labelledSwitch(e) { |
| 13 target: | 13 target: |
| 14 /*0@break*/ | 14 /*0@break*/ |
| 15 switch (e) { | 15 switch (e) { |
| 16 case 0: | 16 case 0: |
| 17 /*target=0*/ break target; | 17 /*target=0*/ break target; |
| 18 } | 18 } |
| 19 } | 19 } |
| 20 | 20 |
| 21 void simpleNestedSwitch(l) { | 21 void switchNestedInLoop(l) { |
| 22 for (var e in l) { | 22 for (var e in l) { |
| 23 target: | 23 target: |
| 24 /*0@break*/ | 24 /*0@break*/ |
| 25 switch (e) { | 25 switch (e) { |
| 26 case 0: | 26 case 0: |
| 27 /*target=0*/ break target; | 27 /*target=0*/ break target; |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 | 31 |
| 32 void simpleNestedLabelledSwitch(l) { | 32 void labelledSwitchNestedInLoop(l) { |
| 33 target: | 33 target: |
| 34 /*0@break*/ | 34 /*0@break*/ |
| 35 for (var e in l) { | 35 for (var e in l) { |
| 36 /*1@break*/ switch (e) { | 36 /*1@break*/ switch (e) { |
| 37 case 0: | 37 case 0: |
| 38 /*target=0*/ break target; | 38 /*target=0*/ break target; |
| 39 case 1: | 39 case 1: |
| 40 /*target=1*/ break; | 40 /*target=1*/ break; |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 void switchWithContinue(e) { |
| 46 /*0@break*/ switch (e) { |
| 47 target: |
| 48 case /*1@continue*/ 0: |
| 49 /*target=0*/ break; |
| 50 case 1: |
| 51 /*target=1*/ continue target; |
| 52 } |
| 53 } |
| 54 |
| 45 void main() { | 55 void main() { |
| 46 simpleSwitch(0); | 56 simpleSwitch(0); |
| 47 simpleLabelledSwitch(0); | 57 labelledSwitch(0); |
| 48 simpleNestedSwitch([]); | 58 switchNestedInLoop([]); |
| 49 simpleNestedLabelledSwitch([]); | 59 labelledSwitchNestedInLoop([]); |
| 60 switchWithContinue(0); |
| 50 } | 61 } |
| OLD | NEW |