Index: tests/language/field_optimization_test.dart |
diff --git a/tests/language/field_optimization_test.dart b/tests/language/field_optimization_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9dea38ba79996a047211caf9a59fc4e7fd7fcc2c |
--- /dev/null |
+++ b/tests/language/field_optimization_test.dart |
@@ -0,0 +1,33 @@ |
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+// Dart test program to test type-based optimization on fields. |
+ |
+ |
+class A { |
+ var x; |
+ A() : x = 0; |
+ foo() { |
+ x++; |
+ } |
+ toto() { |
+ x = 99; |
+ } |
+ bar(y) { |
+ x = y; |
+ } |
+} |
+ |
+class B { |
+ operator +(other) => "ok"; |
+} |
+main() { |
+ var a = new A(); |
+ a.foo(); |
+ a.toto(); |
+ a.bar("str"); |
+ a.bar(new B()); |
+ a.foo(); |
+ Expect.equals("ok", a.x); |
+} |