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

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

Issue 1747943002: Add the @literal 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 7fcde958d6265fa135e23d51c92f213475b7e08c..4d198e04523b793ed5754497f45d599f22fea9d1 100644
--- a/pkg/meta/lib/meta.dart
+++ b/pkg/meta/lib/meta.dart
@@ -30,6 +30,18 @@ library meta;
/// newly allocated object.
const _Factory factory = const _Factory();
+/// Used to annotate a const constructor `c`. Indicates that any invocation of
+/// the constructor must use the keyword `const` unless one or more of the
+/// arguments to the constructor is not a compile-time constant.
+///
+/// Tools, such as the analyzer, can provide feedback if
+/// * the annotation is associated with anything other than a const constructor,
+/// or
+/// * an invocation of a constructor that has this annotation is not invoked
+/// using the `const` keyword unless one or more of the arguments to the
+/// constructor is not a compile-time constant.
+const _Literal literal = const _Literal();
+
/// 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.
@@ -76,6 +88,10 @@ class _Factory {
const _Factory();
}
+class _Literal {
+ const _Literal();
+}
+
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