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