| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /// Constants for use in metadata annotations such as `@protected`. | 5 /// Constants for use in metadata annotations such as `@protected`. |
| 6 /// | 6 /// |
| 7 /// See also `@deprecated` and `@override` in the `dart:core` library. | 7 /// See also `@deprecated` and `@override` in the `dart:core` library. |
| 8 /// | 8 /// |
| 9 /// Annotations provide semantic information that tools can use to provide a | 9 /// Annotations provide semantic information that tools can use to provide a |
| 10 /// better user experience. For example, an IDE might not autocomplete the name | 10 /// better user experience. For example, an IDE might not autocomplete the name |
| 11 /// of a function that's been marked `@deprecated`, or it might display the | 11 /// of a function that's been marked `@deprecated`, or it might display the |
| 12 /// function's name differently. | 12 /// function's name differently. |
| 13 /// | 13 /// |
| 14 /// For information on installing and importing this library, see the | 14 /// For information on installing and importing this library, see the |
| 15 /// [meta package on pub.dartlang.org] (http://pub.dartlang.org/packages/meta). | 15 /// [meta package on pub.dartlang.org] (http://pub.dartlang.org/packages/meta). |
| 16 /// For examples of using annotations, see | 16 /// For examples of using annotations, see |
| 17 /// [Metadata](https://www.dartlang.org/docs/dart-up-and-running/ch02.html#metad
ata) | 17 /// [Metadata](https://www.dartlang.org/docs/dart-up-and-running/ch02.html#metad
ata) |
| 18 /// in the language tour. | 18 /// in the language tour. |
| 19 library meta; | 19 library meta; |
| 20 | 20 |
| 21 /// Used to annotate an instance method `m`. Indicates that every invocation of |
| 22 /// a method that overrides `m` must also invoke `m`. In addition, every method |
| 23 /// that overrides `m` is implicitly annotated with this same annotation. |
| 24 /// |
| 25 /// Note that private methods with this annotation cannot be validly overridden |
| 26 /// outside of the library that defines the annotated method. |
| 27 /// |
| 28 /// Tools, such as the analyzer, can provide feedback if |
| 29 /// * the annotation is associated with anything other than an instance method, |
| 30 /// or |
| 31 /// * a method that overrides a method that has this annotation can return |
| 32 /// without invoking the overridden method. |
| 33 const _MustCallSuper mustCallSuper = const _MustCallSuper(); |
| 34 |
| 21 /// Used to annotate an instance member (method, getter, setter, operator, or | 35 /// Used to annotate an instance member (method, getter, setter, operator, or |
| 22 /// field) `m` in a class `C`. If the annotation is on a field it applies to the | 36 /// field) `m` in a class `C`. If the annotation is on a field it applies to the |
| 23 /// getter and setter, if appropriate, implied by the field. Indicates that `m` | 37 /// getter, and setter if appropriate, that are induced by the field. Indicates |
| 24 /// should only be invoked from instance methods of `C` or classes that extend | 38 /// that `m` should only be invoked from instance methods of `C` or classes that |
| 25 /// or mix in `C`, either directly or indirectly. Additionally indicates that | 39 /// extend or mix in `C`, either directly or indirectly. Additionally indicates |
| 26 /// `m` should only be invoked on `this`, whether explicitly or implicitly. | 40 /// that `m` should only be invoked on `this`, whether explicitly or implicitly. |
| 27 /// | 41 /// |
| 28 /// Tools, such as the analyzer, can provide feedback if | 42 /// Tools, such as the analyzer, can provide feedback if |
| 29 /// * the annotation is associated with anything other than an instance member, | 43 /// * the annotation is associated with anything other than an instance member, |
| 30 /// or | 44 /// or |
| 31 /// * an invocation of a member marked as being protected is used outside of an | 45 /// * an invocation of a member that has this annotation is used outside of an |
| 32 /// instance member defined on a class that extends or mixes in the class in | 46 /// instance member defined on a class that extends or mixes in the class in |
| 33 /// which the protected member is defined, or that uses a receiver other than | 47 /// which the protected member is defined, or that uses a receiver other than |
| 34 /// `this`. | 48 /// `this`. |
| 35 const _Protected protected = const _Protected(); | 49 const _Protected protected = const _Protected(); |
| 36 | 50 |
| 37 /// Used to annotate a named parameter `p` in a method or function `f`. | 51 /// Used to annotate a named parameter `p` in a method or function `f`. |
| 38 /// Indicates that every invocation of `f` must include an argument | 52 /// Indicates that every invocation of `f` must include an argument |
| 39 /// corresponding to `p`, despite the fact that `p` would otherwise be an | 53 /// corresponding to `p`, despite the fact that `p` would otherwise be an |
| 40 /// optional parameter. | 54 /// optional parameter. |
| 41 /// | 55 /// |
| 42 /// Tools, such as the analyzer, can provide feedback if | 56 /// Tools, such as the analyzer, can provide feedback if |
| 43 /// * the annotation is associated with anything other than a named parameter, | 57 /// * the annotation is associated with anything other than a named parameter, |
| 44 /// or | 58 /// or |
| 45 /// * an invocation of a method or function does not include an argument | 59 /// * an invocation of a method or function does not include an argument |
| 46 /// corresponding to a named parameter that has this annotation. | 60 /// corresponding to a named parameter that has this annotation. |
| 47 const _Required required = const _Required(); | 61 const _Required required = const _Required(); |
| 48 | 62 |
| 63 class _MustCallSuper { |
| 64 const _MustCallSuper(); |
| 65 } |
| 66 |
| 49 class _Protected { | 67 class _Protected { |
| 50 const _Protected(); | 68 const _Protected(); |
| 51 } | 69 } |
| 52 | 70 |
| 53 class _Required { | 71 class _Required { |
| 54 const _Required(); | 72 const _Required(); |
| 55 } | 73 } |
| OLD | NEW |