| 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 | |
| 7 // Dart test program to test type-based optimization on fields. | 5 // Dart test program to test type-based optimization on fields. |
| 8 | 6 |
| 9 | 7 |
| 10 class A { | 8 class A { |
| 11 var x; | 9 var x; |
| 12 A() : x = 0; | 10 A() : x = 0; |
| 13 foo() { | 11 foo() { |
| 14 x++; | 12 x++; |
| 15 } | 13 } |
| 16 toto() { | 14 toto() { |
| 17 x = 99; | 15 x = 99; |
| 18 } | 16 } |
| 19 bar(y) { | 17 bar(y) { |
| 20 x = y; | 18 x = y; |
| 21 } | 19 } |
| 22 } | 20 } |
| 23 | 21 |
| 24 class B { | 22 class B { |
| 25 operator +(other) => "ok"; | 23 operator +(other) => "ok"; |
| 26 } | 24 } |
| 27 main() { | 25 main() { |
| 28 var a = new A(); | 26 var a = new A(); |
| 29 a.foo(); | 27 a.foo(); |
| 30 a.toto(); | 28 a.toto(); |
| 31 a.bar("str"); | 29 a.bar("str"); |
| 32 a.bar(new B()); | 30 a.bar(new B()); |
| 33 a.foo(); | 31 a.foo(); |
| 34 Expect.equals("ok", a.x); | 32 Expect.equals("ok", a.x); |
| 35 } | 33 } |
| OLD | NEW |