| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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"; |
| 6 |
| 5 // Dart test program to test type-based optimization on fields. | 7 // Dart test program to test type-based optimization on fields. |
| 6 | 8 |
| 7 class A { | 9 class A { |
| 8 var a = 0; | 10 var a = 0; |
| 9 var b = 0; | 11 var b = 0; |
| 10 foo() { | 12 foo() { |
| 11 var c = b + 27; | 13 var c = b + 27; |
| 12 for (var i = 0; i < 1 ; i++) { | 14 for (var i = 0; i < 1 ; i++) { |
| 13 for (var j = 0; j < 1; j++) { | 15 for (var j = 0; j < 1; j++) { |
| 14 Expect.equals(50, c + 23); | 16 Expect.equals(50, c + 23); |
| 15 } | 17 } |
| 16 } | 18 } |
| 17 return a > 0.2; | 19 return a > 0.2; |
| 18 } | 20 } |
| 19 setA(value) { a = value; } | 21 setA(value) { a = value; } |
| 20 setB(value) { b = value; } | 22 setB(value) { b = value; } |
| 21 operator >(other) => other == 0.2; | 23 operator >(other) => other == 0.2; |
| 22 } | 24 } |
| 23 | 25 |
| 24 main() { | 26 main() { |
| 25 var a = new A(); | 27 var a = new A(); |
| 26 Expect.isFalse(a.foo()); | 28 Expect.isFalse(a.foo()); |
| 27 a.setA(new A()); | 29 a.setA(new A()); |
| 28 a.setB(0); | 30 a.setB(0); |
| 29 Expect.isTrue(a.foo()); | 31 Expect.isTrue(a.foo()); |
| 30 } | 32 } |
| OLD | NEW |