| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library methods; | 5 library methods; |
| 6 | 6 |
| 7 class A { | 7 class A { |
| 8 int x() => 42; | 8 int x() => 42; |
| 9 | 9 |
| 10 int y(int a) { | 10 int y(int a) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 call(x) => print('hello from $x'); | 40 call(x) => print('hello from $x'); |
| 41 } | 41 } |
| 42 class Foo { | 42 class Foo { |
| 43 final Bar bar = new Bar(); | 43 final Bar bar = new Bar(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 test() { | 46 test() { |
| 47 // looks like a method but is actually f.bar.call(...) | 47 // looks like a method but is actually f.bar.call(...) |
| 48 var f = new Foo(); | 48 var f = new Foo(); |
| 49 f.bar("Bar's call method!"); | 49 f.bar("Bar's call method!"); |
| 50 |
| 51 // Tear-off |
| 52 A a = new A(); |
| 53 var g = a.x; |
| 54 |
| 55 // Dynamic Tear-off |
| 56 dynamic aa = new A(); |
| 57 var h = aa.x; |
| 50 } | 58 } |
| OLD | NEW |