OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Regression test for dart2js that used to crash on this code. | 5 // Regression test for dart2js that used to crash on this code. |
6 | 6 |
7 class A { | 7 class A { |
8 operator[]=(index, value) { | 8 operator []=(index, value) { |
9 switch (value) { | 9 switch (value) { |
10 case 42: break; | 10 case 42: |
11 case 43: break; | 11 break; |
| 12 case 43: |
| 13 break; |
12 } | 14 } |
13 } | 15 } |
14 } | 16 } |
15 | 17 |
16 main() { | 18 main() { |
17 // Make [a] a phi. | 19 // Make [a] a phi. |
18 var a; | 20 var a; |
19 if (true) { | 21 if (true) { |
20 a = new A(); | 22 a = new A(); |
21 } else { | 23 } else { |
22 a = new A(); | 24 a = new A(); |
23 } | 25 } |
24 // `A[]=` being inlined, the compiler was confused when merging the | 26 // `A[]=` being inlined, the compiler was confused when merging the |
25 // phis after the switch. | 27 // phis after the switch. |
26 a[0] = 42; | 28 a[0] = 42; |
27 | 29 |
28 // Use [a] to provoke the crash. | 30 // Use [a] to provoke the crash. |
29 print(a); | 31 print(a); |
30 } | 32 } |
OLD | NEW |