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

Side by Side 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, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 `m` must either be
22 /// abstract or must return a newly allocated object. In addition, every method
23 /// that either implements or overrides `m` is implicitly annotated with this
24 /// same annotation.
25 ///
26 /// Tools, such as the analyzer, can provide feedback if
27 /// * the annotation is associated with anything other than an instance method,
28 /// or
29 /// * a method that has this annotation that can return anything other than a
30 /// newly allocated object.
31 const _Factory factory = const _Factory();
32
21 /// Used to annotate an instance method `m`. Indicates that every invocation of 33 /// 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 34 /// a method that overrides `m` must also invoke `m`. In addition, every method
23 /// that overrides `m` is implicitly annotated with this same annotation. 35 /// that overrides `m` is implicitly annotated with this same annotation.
24 /// 36 ///
25 /// Note that private methods with this annotation cannot be validly overridden 37 /// Note that private methods with this annotation cannot be validly overridden
26 /// outside of the library that defines the annotated method. 38 /// outside of the library that defines the annotated method.
27 /// 39 ///
28 /// Tools, such as the analyzer, can provide feedback if 40 /// Tools, such as the analyzer, can provide feedback if
29 /// * the annotation is associated with anything other than an instance method, 41 /// * the annotation is associated with anything other than an instance method,
30 /// or 42 /// or
(...skipping 22 matching lines...) Expand all
53 /// corresponding to `p`, despite the fact that `p` would otherwise be an 65 /// corresponding to `p`, despite the fact that `p` would otherwise be an
54 /// optional parameter. 66 /// optional parameter.
55 /// 67 ///
56 /// Tools, such as the analyzer, can provide feedback if 68 /// Tools, such as the analyzer, can provide feedback if
57 /// * the annotation is associated with anything other than a named parameter, 69 /// * the annotation is associated with anything other than a named parameter,
58 /// or 70 /// or
59 /// * an invocation of a method or function does not include an argument 71 /// * an invocation of a method or function does not include an argument
60 /// corresponding to a named parameter that has this annotation. 72 /// corresponding to a named parameter that has this annotation.
61 const _Required required = const _Required(); 73 const _Required required = const _Required();
62 74
75 class _Factory {
76 const _Factory();
77 }
78
63 class _MustCallSuper { 79 class _MustCallSuper {
64 const _MustCallSuper(); 80 const _MustCallSuper();
65 } 81 }
66 82
67 class _Protected { 83 class _Protected {
68 const _Protected(); 84 const _Protected();
69 } 85 }
70 86
71 class _Required { 87 class _Required {
72 const _Required(); 88 const _Required();
73 } 89 }
OLDNEW
« 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