| 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 during the | 5 // Regression test for dart2js that used to crash during the |
| 6 // [SsaCodeMotion] phase on this code. | 6 // [SsaCodeMotion] phase on this code. |
| 7 | 7 |
| 8 class A { | 8 class A { |
| 9 final finalField; | 9 final finalField; |
| 10 var field = 2; | 10 var field = 2; |
| 11 foo() { | 11 foo() { |
| 12 new A().field = 42; | 12 new A().field = 42; |
| 13 } | 13 } |
| 14 |
| 14 A._() : finalField = 42; | 15 A._() : finalField = 42; |
| 15 A() : finalField = [new A._(), new B(), new Object()][1]; | 16 A() : finalField = [new A._(), new B(), new Object()][1]; |
| 16 } | 17 } |
| 17 | 18 |
| 18 class B { | 19 class B { |
| 19 foo() {} | 20 foo() {} |
| 20 bar() {} | 21 bar() {} |
| 21 } | 22 } |
| 22 | 23 |
| 23 main() { | 24 main() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 // the call to [bar]. | 35 // the call to [bar]. |
| 35 var c = a.finalField; | 36 var c = a.finalField; |
| 36 c.foo(); | 37 c.foo(); |
| 37 | 38 |
| 38 // [e] does not get GVN'ed because the GVN phase sees [c.foo()] as | 39 // [e] does not get GVN'ed because the GVN phase sees [c.foo()] as |
| 39 // having side effects. | 40 // having side effects. |
| 40 var e = a.field; | 41 var e = a.field; |
| 41 if (d + e != 4) throw 'Test failed'; | 42 if (d + e != 4) throw 'Test failed'; |
| 42 } | 43 } |
| 43 } | 44 } |
| OLD | NEW |