| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011, 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 // Dart test program for testing invocation of implicit closures. | |
| 5 | |
| 6 class BaseClass { | |
| 7 BaseClass(this._i) {} | |
| 8 int foo() { return _i; } | |
| 9 int _i; | |
| 10 } | |
| 11 | |
| 12 class DerivedClass extends BaseClass { | |
| 13 DerivedClass(this._y, int j) : super(j) {} | |
| 14 int foo() { return _y; } | |
| 15 getSuper() { return super.foo; } | |
| 16 int _y; | |
| 17 } | |
| 18 | |
| 19 class SuperImplicitClosureTest { | |
| 20 static void testMain() { | |
| 21 DerivedClass obj = new DerivedClass(20, 10); | |
| 22 | |
| 23 var ib = obj.foo; | |
| 24 Expect.equals(obj._y, ib()); | |
| 25 | |
| 26 ib = obj.getSuper(); | |
| 27 Expect.equals(obj._i, ib()); | |
| 28 } | |
| 29 } | |
| 30 | |
| 31 | |
| 32 main() { | |
| 33 SuperImplicitClosureTest.testMain(); | |
| 34 } | |
| OLD | NEW |