OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import "package:expect/expect.dart"; |
| 6 |
| 7 // Regression test for dart2js that used to miscompile [A.foo]. |
| 8 |
| 9 var global = 54; |
| 10 |
| 11 class A { |
| 12 int a = 0; |
| 13 int b = 42; |
| 14 final int c = global; |
| 15 foo() { |
| 16 int start = a - 1; |
| 17 a = 54; |
| 18 if (b == 42) { |
| 19 b = 32; |
| 20 } else { |
| 21 b = 42; |
| 22 } |
| 23 Expect.equals(-1, start); |
| 24 } |
| 25 |
| 26 bar() { |
| 27 int start = a - c - 1; |
| 28 a = 42; |
| 29 if (b == 42) { |
| 30 b = 32; |
| 31 } else { |
| 32 b = 42; |
| 33 } |
| 34 Expect.equals(-55, start); |
| 35 } |
| 36 } |
| 37 |
| 38 main() { |
| 39 new A().foo(); |
| 40 new A().bar(); |
| 41 } |
OLD | NEW |