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 /** | 5 /** |
6 * Constants for use in metadata annotations such as | 6 * Constants for use in metadata annotations such as |
7 * `@deprecated`, `@override`, and `@proxy`. | 7 * `@proxy`. |
8 * | 8 * |
| 9 * See also `@deprecated` and `@override` in the `dart:core` library. |
| 10 * |
9 * Annotations provide semantic information | 11 * Annotations provide semantic information |
10 * that tools can use to provide a better user experience. | 12 * that tools can use to provide a better user experience. |
11 * For example, an IDE might not autocomplete | 13 * For example, an IDE might not autocomplete |
12 * the name of a function that's been marked `@deprecated`, | 14 * the name of a function that's been marked `@deprecated`, |
13 * or it might display the function's name differently. | 15 * or it might display the function's name differently. |
14 * | 16 * |
15 * For information on installing and importing this library, see the | 17 * For information on installing and importing this library, see the |
16 * [meta package on pub.dartlang.org] | 18 * [meta package on pub.dartlang.org] |
17 * (http://pub.dartlang.org/packages/meta). | 19 * (http://pub.dartlang.org/packages/meta). |
18 * For examples of using annotations, see | 20 * For examples of using annotations, see |
19 * [Metadata](https://www.dartlang.org/docs/dart-up-and-running/contents/ch02.ht
ml#ch02-metadata) | 21 * [Metadata](https://www.dartlang.org/docs/dart-up-and-running/contents/ch02.ht
ml#ch02-metadata) |
20 * in the language tour. | 22 * in the language tour. |
21 */ | 23 */ |
22 library meta; | 24 library meta; |
23 | 25 |
24 /** | 26 /** |
25 * An annotation used to mark a class, field, getter, setter, method, top-level | |
26 * variable, or top-level function as one that should no longer be used. Tools | |
27 * can use this annotation to provide a warning on references to the marked | |
28 * element. | |
29 */ | |
30 const deprecated = const _Deprecated(); | |
31 | |
32 class _Deprecated { | |
33 const _Deprecated(); | |
34 } | |
35 | |
36 /** | |
37 * An annotation used to mark an instance member (method, field, getter or | |
38 * setter) as overriding an inherited class member. Tools can use this | |
39 * annotation to provide a warning if there is no overridden member. | |
40 */ | |
41 const override = const _Override(); | |
42 | |
43 class _Override { | |
44 const _Override(); | |
45 } | |
46 | |
47 /** | |
48 * An annotation used to mark a class that should be considered to implement | 27 * An annotation used to mark a class that should be considered to implement |
49 * every possible getter, setter and method. Tools can use this annotation to | 28 * every possible getter, setter and method. Tools can use this annotation to |
50 * suppress warnings when there is no explicit implementation of a referenced | 29 * suppress warnings when there is no explicit implementation of a referenced |
51 * member. Tools should provide a hint if this annotation is applied to a class | 30 * member. Tools should provide a hint if this annotation is applied to a class |
52 * that does not implement or inherit an implementation of the method | 31 * that does not implement or inherit an implementation of the method |
53 * [:noSuchMethod:] (other than the implementation in [Object]). Note that | 32 * [:noSuchMethod:] (other than the implementation in [Object]). Note that |
54 * classes are not affected by the use of this annotation on a supertype. | 33 * classes are not affected by the use of this annotation on a supertype. |
55 */ | 34 */ |
56 const proxy = const _Proxy(); | 35 const proxy = const _Proxy(); |
57 | 36 |
58 class _Proxy { | 37 class _Proxy { |
59 const _Proxy(); | 38 const _Proxy(); |
60 } | 39 } |
OLD | NEW |