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) { |
11 return a; | 11 return a; |
12 } | 12 } |
13 | 13 |
14 int z([num b]) => b; | 14 int z([num b]) => b; |
15 | 15 |
16 int zz([int b = 0]) => b; | 16 int zz([int b = 0]) => b; |
17 | 17 |
18 int w(int a, {num b}) { | 18 int w(int a, {num b}) { |
19 return a + b; | 19 return a + b; |
20 } | 20 } |
21 | 21 |
22 int ww(int a, {int b: 0}) { | 22 clashWithObjectProperty({constructor}) => constructor; |
23 return a + b; | 23 clashWithJsReservedName({function}) => function; |
24 } | |
25 | 24 |
26 int get a => x(); | 25 int get a => x(); |
27 | 26 |
28 void set b(int b) {} | 27 void set b(int b) {} |
29 | 28 |
30 int _c = 3; | 29 int _c = 3; |
31 | 30 |
32 int get c => _c; | 31 int get c => _c; |
33 | 32 |
34 void set c(int c) { | 33 void set c(int c) { |
(...skipping 22 matching lines...) Expand all Loading... |
57 var h = aa.x; | 56 var h = aa.x; |
58 | 57 |
59 // Tear-off of object methods | 58 // Tear-off of object methods |
60 var ts = a.toString; | 59 var ts = a.toString; |
61 var nsm = a.noSuchMethod; | 60 var nsm = a.noSuchMethod; |
62 | 61 |
63 // Tear-off extension methods | 62 // Tear-off extension methods |
64 var c = "".padLeft; | 63 var c = "".padLeft; |
65 var r = (3.0).floor; | 64 var r = (3.0).floor; |
66 } | 65 } |
OLD | NEW |