| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 switcher(val) { | 5 switcher(val) { |
| 6 var x = 0; | 6 var x = 0; |
| 7 switch (val) { | 7 switch (val) { |
| 8 case 1: | 8 case 1: |
| 9 x = 100; | 9 x = 100; |
| 10 break; | 10 break; |
| 11 case 2: | 11 case 2: |
| 12 x = 200; | 12 x = 200; |
| 13 break; | 13 break; |
| 14 case 3: | 14 case 3: |
| 15 x = 300; | 15 x = 300; |
| 16 break; | 16 break; |
| 17 default: | 17 default: |
| 18 return 400; | 18 return 400; |
| 19 break; // Intentional dead code (regression test for crash). | 19 break; // Intentional dead code (regression test for crash). |
| 20 } | 20 } |
| 21 return x; | 21 return x; |
| 22 } | 22 } |
| 23 | 23 |
| 24 main() { | 24 main() { |
| 25 Expect.equals(100, switcher(1)); | 25 Expect.equals(100, switcher(1)); |
| 26 Expect.equals(200, switcher(2)); | 26 Expect.equals(200, switcher(2)); |
| 27 Expect.equals(300, switcher(3)); | 27 Expect.equals(300, switcher(3)); |
| 28 Expect.equals(400, switcher(4)); | 28 Expect.equals(400, switcher(4)); |
| 29 } | 29 } |
| OLD | NEW |