| 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 | 6 |
| 7 // Regression test for dart2js that used to crash on this program. | 7 // Regression test for dart2js that used to crash on this program. |
| 8 | 8 |
| 9 class A { | 9 class A { |
| 10 var b; | 10 var b; |
| 11 | 11 |
| 12 // The closure in the constructor body used to confuse the SSA builder | 12 // The closure in the constructor body used to confuse the SSA builder |
| 13 // when it created the call to the constructor body. | 13 // when it created the call to the constructor body. |
| 14 A.withClosure(Map a) { | 14 A.withClosure(Map a) { |
| 15 var c; | 15 var c; |
| 16 var f = () { return c = 42; }; | 16 var f = () { |
| 17 return c = 42; |
| 18 }; |
| 17 b = f(); | 19 b = f(); |
| 18 Expect.equals(42, b); | 20 Expect.equals(42, b); |
| 19 Expect.equals(42, c); | 21 Expect.equals(42, c); |
| 20 } | 22 } |
| 21 } | 23 } |
| 22 | 24 |
| 23 main() { | 25 main() { |
| 24 new A.withClosure(null); | 26 new A.withClosure(null); |
| 25 new A.withClosure({}); | 27 new A.withClosure({}); |
| 26 } | 28 } |
| OLD | NEW |