| 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 class A { | 7 class A { |
| 6 foo() => 499; | 8 foo() => 499; |
| 7 bar({a: 1, b: 7, c: 99}) => a + b + c; | 9 bar({a: 1, b: 7, c: 99}) => a + b + c; |
| 8 toto() => bar; | 10 toto() => bar; |
| 9 gee(f) => f(toto); | 11 gee(f) => f(toto); |
| 10 } | 12 } |
| 11 | 13 |
| 12 main() { | 14 main() { |
| 13 var a = new A(); | 15 var a = new A(); |
| 14 var foo = a.foo; | 16 var foo = a.foo; |
| 15 Expect.equals(499, foo()); | 17 Expect.equals(499, foo()); |
| 16 var bar = a.bar; | 18 var bar = a.bar; |
| 17 Expect.equals(107, bar()); | 19 Expect.equals(107, bar()); |
| 18 Expect.equals(3, bar(a: 1, b: 1, c: 1)); | 20 Expect.equals(3, bar(a: 1, b: 1, c: 1)); |
| 19 Expect.equals(10, bar(c: 2)); | 21 Expect.equals(10, bar(c: 2)); |
| 20 var toto = a.toto; | 22 var toto = a.toto; |
| 21 var gee = a.gee; | 23 var gee = a.gee; |
| 22 Expect.equals(-10, gee((f) => f()(a: -1, b: -2, c: -7))); | 24 Expect.equals(-10, gee((f) => f()(a: -1, b: -2, c: -7))); |
| 23 } | 25 } |
| OLD | NEW |