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