Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: pkg/meta/lib/meta.dart

Issue 1740763003: Define the mustCallSuper annotation (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/meta/lib/meta.dart
diff --git a/pkg/meta/lib/meta.dart b/pkg/meta/lib/meta.dart
index 71a64e67327b40e945e86b08e2088eb7a3735262..f9b96c06b34cde8e536209a0cb08b3b49381efae 100644
--- a/pkg/meta/lib/meta.dart
+++ b/pkg/meta/lib/meta.dart
@@ -18,17 +18,31 @@
/// in the language tour.
library meta;
+/// Used to annotate an instance method `m`. Indicates that every invocation of
+/// a method that overrides `m` must also invoke `m`. In addition, every method
+/// that overrides `m` is implicitly annotated with this same annotation.
+///
+/// Note that private methods with this annotation cannot be validly overridden
+/// outside of the library that defines the annotated method.
+///
+/// Tools, such as the analyzer, can provide feedback if
+/// * the annotation is associated with anything other than an instance method,
+/// or
+/// * a method that overrides a method that has this annotation can return
+/// without invoking the overridden method.
+const _MustCallSuper mustCallSuper = const _MustCallSuper();
+
/// Used to annotate an instance member (method, getter, setter, operator, or
/// field) `m` in a class `C`. If the annotation is on a field it applies to the
-/// getter and setter, if appropriate, implied by the field. Indicates that `m`
-/// should only be invoked from instance methods of `C` or classes that extend
-/// or mix in `C`, either directly or indirectly. Additionally indicates that
-/// `m` should only be invoked on `this`, whether explicitly or implicitly.
+/// getter, and setter if appropriate, that are induced by the field. Indicates
+/// that `m` should only be invoked from instance methods of `C` or classes that
+/// extend or mix in `C`, either directly or indirectly. Additionally indicates
+/// that `m` should only be invoked on `this`, whether explicitly or implicitly.
///
/// Tools, such as the analyzer, can provide feedback if
/// * the annotation is associated with anything other than an instance member,
/// or
-/// * an invocation of a member marked as being protected is used outside of an
+/// * an invocation of a member that has this annotation is used outside of an
/// instance member defined on a class that extends or mixes in the class in
/// which the protected member is defined, or that uses a receiver other than
/// `this`.
@@ -46,6 +60,10 @@ const _Protected protected = const _Protected();
/// corresponding to a named parameter that has this annotation.
const _Required required = const _Required();
+class _MustCallSuper {
+ const _MustCallSuper();
+}
+
class _Protected {
const _Protected();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698