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

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

Issue 1735313005: Add @factory 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 f9b96c06b34cde8e536209a0cb08b3b49381efae..7fcde958d6265fa135e23d51c92f213475b7e08c 100644
--- a/pkg/meta/lib/meta.dart
+++ b/pkg/meta/lib/meta.dart
@@ -18,6 +18,18 @@
/// in the language tour.
library meta;
+/// Used to annotate an instance method `m`. Indicates that `m` must either be
+/// abstract or must return a newly allocated object. In addition, every method
+/// that either implements or overrides `m` is implicitly annotated with this
+/// same annotation.
+///
+/// Tools, such as the analyzer, can provide feedback if
+/// * the annotation is associated with anything other than an instance method,
+/// or
+/// * a method that has this annotation that can return anything other than a
+/// newly allocated object.
+const _Factory factory = const _Factory();
+
/// 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.
@@ -60,6 +72,10 @@ const _Protected protected = const _Protected();
/// corresponding to a named parameter that has this annotation.
const _Required required = const _Required();
+class _Factory {
+ const _Factory();
+}
+
class _MustCallSuper {
const _MustCallSuper();
}
« 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