| 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. There was a bug in the variable | 5 // Regression test for dart2js. There was a bug in the variable |
| 6 // allocator when a pure (side-effect free) instruction stand | 6 // allocator when a pure (side-effect free) instruction stand |
| 7 // in-between an inlined `if` and its inlined expression. | 7 // in-between an inlined `if` and its inlined expression. |
| 8 | 8 |
| 9 import "package:expect/expect.dart"; | 9 import "package:expect/expect.dart"; |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // optimizers as being also a JavaScript expression, we do not | 30 // optimizers as being also a JavaScript expression, we do not |
| 31 // allocate a name for it. But some expressions that it uses still | 31 // allocate a name for it. But some expressions that it uses still |
| 32 // can have a name, and our variable allocator did not handle live | 32 // can have a name, and our variable allocator did not handle live |
| 33 // variables due to the inlining of the ternary expression in [foo]. | 33 // variables due to the inlining of the ternary expression in [foo]. |
| 34 if (foo(topLevel) == null) { | 34 if (foo(topLevel) == null) { |
| 35 return b.toString(); | 35 return b.toString(); |
| 36 } else { | 36 } else { |
| 37 return b.hashCode; | 37 return b.hashCode; |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 |
| 40 return f(); | 41 return f(); |
| 41 } | 42 } |
| 42 | 43 |
| 43 main() { | 44 main() { |
| 44 // Make sure the inferrer does not get an exact type for [topLevel]. | 45 // Make sure the inferrer does not get an exact type for [topLevel]. |
| 45 topLevel = new Object(); | 46 topLevel = new Object(); |
| 46 topLevel = main; | 47 topLevel = main; |
| 47 var res = bar(); | 48 var res = bar(); |
| 48 Expect.isTrue(res is String); | 49 Expect.isTrue(res is String); |
| 49 } | 50 } |
| OLD | NEW |