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

Side by Side Diff: test/generated_sdk/lib/core/annotations.dart

Issue 1162723007: remove generated_sdk from checked in code (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 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 | « test/generated_sdk/lib/convert/utf.dart ('k') | test/generated_sdk/lib/core/bool.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4
5 part of dart.core;
6
7 // TODO(jacobr): move these annotations to a different package. E.g. dart:js
8
9 class JsName {
10 /// The JavaScript name.
11 /// Used for classes and libraries.
12 /// Note that this could be an expression, e.g. `lib.TypeName` in JS, but it
13 /// should be kept simple, as it will be generated directly into the code.
14 final String name;
15 const JsName({this.name});
16 }
17
18 class JsPeerInterface {
19 /// The JavaScript type that we should match the API of.
20 /// Used for classes where Dart subclasses should be callable from JavaScript
21 /// matching the JavaScript calling conventions.
22 final String name;
23 const JsPeerInterface({this.name});
24 }
25
26 /// A Dart interface may only be implemented by a native JavaScript object
27 /// if it is marked with this annotation.
28 class SupportJsExtensionMethod {
29 const SupportJsExtensionMethod();
30 }
31
32 /**
33 * The annotation `@Deprecated('expires when')` marks a feature as deprecated.
34 *
35 * The annotation `@deprecated` is a shorthand for deprecating until
36 * an unspecified "next release".
37 *
38 * The intent of the `@Deprecated` annotation is to inform users of a feature
39 * that they should change their code, even if it is currently still working
40 * correctly.
41 *
42 * A deprecated feature is scheduled to be removed at a later time, possibly
43 * specified as the "expires" field of the annotation.
44 * This means that a deprecated feature should not be used, or code using it
45 * will break at some point in the future. If there is code using the feature,
46 * that code should be rewritten to not use the deprecated feature.
47 *
48 * A deprecated feature should document how the same effect can be achieved,
49 * so the programmer knows how to rewrite the code.
50 *
51 * The `@Deprecated` annotation applies to libraries, top-level declarations
52 * (variables, getters, setters, functions, classes and typedefs),
53 * class-level declarations (variables, getters, setters, methods, operators or
54 * constructors, whether static or not), named optional arguments and
55 * trailing optional positional parameters.
56 *
57 * Deprecation is transitive:
58 *
59 * - If a library is deprecated, so is every member of it.
60 * - If a class is deprecated, so is every member of it.
61 * - If a variable is deprecated, so are its implicit getter and setter.
62 *
63 *
64 * A tool that processes Dart source code may report when:
65 *
66 * - the code imports a deprecated library.
67 * - the code exports a deprecated library, or any deprecated member of
68 *  a non-deprecated library.
69 * - the code refers statically to a deprecated declaration.
70 * - the code dynamically uses a member of an object with a statically known
71 * type, where the member is deprecated on the static type of the object.
72 * - the code dynamically calls a method with an argument where the
73 * corresponding optional parameter is deprecated on the object's static type.
74 *
75 *
76 * If the deprecated use is inside a library, class or method which is itself
77 * deprecated, the tool should not bother the user about it.
78 * A deprecated feature is expected to use other deprecated features.
79 */
80 class Deprecated {
81 /**
82 * A description of when the deprecated feature is expected to be retired.
83 */
84 final String expires;
85
86 /**
87 * Create a deprecation annotation which specifies the expiration of the
88 * annotated feature.
89 *
90 * The [expires] argument should be readable by programmers, and should state
91 * when an annotated feature is expected to be removed.
92 * This can be specified, for example, as a date, as a release number, or
93 * as relative to some other change (like "when bug 4418 is fixed").
94 */
95 const Deprecated(String expires) : this.expires = expires;
96
97 String toString() => "Deprecated feature. Will be removed $expires";
98 }
99
100 class _Override {
101 const _Override();
102 }
103
104 /**
105 * Marks a feature as [Deprecated] until the next release.
106 */
107 const Deprecated deprecated = const Deprecated("next release");
108
109 /**
110 * The annotation `@override` marks an instance member as overriding a
111 * superclass member with the same name.
112 *
113 * The annotation applies to instance methods, getters and setters, and to
114 * instance fields, where it means that the implicit getter and setter of the
115 * field is marked as overriding, but the field itself is not.
116 *
117 * The intent of the `@override` notation is to catch situations where a
118 * superclass renames a member, and an independent subclass which used to
119 * override the member, could silently continue working using the
120 * superclass implementation.
121 *
122 * The editor, or a similar tool aimed at the programmer, may report if no
123 * declaration of an annotated member is inherited by the class from either a
124 * superclass or an interface.
125 *
126 * Use the `@override` annotation judiciously and only for methods where
127 * the superclass is not under the programmer's control, the superclass is in a
128 * different library or package, and it is not considered stable.
129 * In any case, the use of `@override` is optional.
130 *
131 * For example, the annotation is intentionally not used in the Dart platform
132 * libraries, since they only depend on themselves.
133 */
134 const Object override = const _Override();
135
136 class _Proxy {
137 const _Proxy();
138 }
139
140 /**
141 * The annotation `@proxy` marks a class as implementing interfaces and members
142 * dynamically through `noSuchMethod`.
143 *
144 * The annotation applies to any class. It is inherited by subclasses from both
145 * superclass and interfaces.
146 *
147 * If a class is annotated with `@proxy`, or it implements any class that is
148 * annotated, then the class is considered to implement any interface and
149 * any member with regard to static type analysis. As such, it is not a static
150 * type warning to assign the object to a variable of any type, and it is not
151 * a static type warning to access any member of the object.
152 *
153 * This only applies to static type warnings. The runtime type of the object
154 * is unaffected. It is not considered to implement any special interfaces at
155 * runtime, so assigning it to a typed variable may fail in checked mode, and
156 * testing it with the `is` operator will not work for any type except the
157 * ones it actually implements.
158 *
159 * Tools that understand `@proxy` should tell the user if a class using `@proxy`
160 * does not override the `noSuchMethod` declared on [Object].
161 *
162 * The intent of the `@proxy` notation is to create objects that implement a
163 * type (or multiple types) that are not known at compile time. If the types
164 * are known at compile time, a class can be written that implements these
165 * types.
166 */
167 const Object proxy = const _Proxy();
OLDNEW
« no previous file with comments | « test/generated_sdk/lib/convert/utf.dart ('k') | test/generated_sdk/lib/core/bool.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698