OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 main() { | 5 main() { |
6 switch (1) { | 6 switch (1) { |
7 case 1: | 7 case 1: |
8 { | 8 { |
9 "No fall-through error needed."; | 9 "No fall-through error needed."; |
10 break; | 10 break; |
11 ; // Empty statement. | 11 ; // Empty statement. |
12 } | 12 } |
13 case 2: | 13 case 2: |
14 { | 14 { |
15 "Fall-through error needed."; | 15 "Fall-through error needed."; |
16 if (true) { | 16 if (true) { |
17 break; | 17 break; |
| 18 } |
18 } | 19 } |
19 } | |
20 case 3: | 20 case 3: |
21 try { | 21 try { |
22 "No fall-through error needed."; | 22 "No fall-through error needed."; |
23 } finally { | 23 } finally { |
24 break; | 24 break; |
25 } | 25 } |
26 case 4: | 26 case 4: |
27 try { | 27 try { |
28 "No fall-through error needed."; | 28 "No fall-through error needed."; |
29 break; | 29 break; |
30 } finally { | 30 } finally {} |
31 } | |
32 case 5: | 31 case 5: |
33 try { | 32 try { |
34 "Fall-through error needed."; | 33 "Fall-through error needed."; |
35 } finally { | 34 } finally {} |
36 } | |
37 case 10000: | 35 case 10000: |
38 "Should be last. No fall-through error, falling through allowed here."; | 36 "Should be last. No fall-through error, falling through allowed here."; |
39 } | 37 } |
40 } | 38 } |
OLD | NEW |