Index: tests/language/field_optimization2_test.dart |
diff --git a/tests/language/implicit_closure2_test.dart b/tests/language/field_optimization2_test.dart |
similarity index 58% |
copy from tests/language/implicit_closure2_test.dart |
copy to tests/language/field_optimization2_test.dart |
index 40c47bec801509d574a197da88cd97f931eeae78..d8b6ec3c2e908fcce428e3106849d8425ff842ce 100644 |
--- a/tests/language/implicit_closure2_test.dart |
+++ b/tests/language/field_optimization2_test.dart |
@@ -2,21 +2,23 @@ |
// 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. |
-class B { |
- foo(i) => 499 + i; |
-} |
+// Dart test program to test type-based optimization on fields. |
-class A { |
- var b; |
- A() : b = new B(); |
- foo(i) { return (() => b.foo(i))(); } |
+class A { |
+ var x; |
+ A() : x = new B(); |
+ foo() { |
+ x++; |
+ } |
} |
+class B { |
+ operator +(other) => 498; |
+} |
main() { |
var a = new A(); |
- Expect.equals(510, a.foo(11)); |
- var f = a.foo; |
- Expect.equals(521, f(22)); |
+ a.foo(); |
+ a.foo(); |
+ Expect.equals(499, a.x); |
} |
- |