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

Side by Side Diff: pkg/compiler/lib/src/mirrors/source_mirrors.dart

Issue 1799283002: Delete support for source mirrors (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: new attempt Created 4 years, 7 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
OLDNEW
(Empty)
1 // Copyright (c) 2012, 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 library mirrors;
6
7 import 'dart:mirrors';
8 import 'dart:mirrors' as api show SourceLocation;
9 export 'dart:mirrors';
10
11 abstract class DeclarationSourceMirror implements DeclarationMirror {
12 /// Returns `true` if the name of this declaration is generated by the
13 /// provider of the mirror system.
14 bool get isNameSynthetic;
15
16 /**
17 * Looks up [name] in the scope of this declaration.
18 *
19 * [name] may be either a single identifier, like 'foo', or of the
20 * a prefixed identifier, like 'foo.bar', where 'foo' must be a prefix.
21 * For methods and constructors, the scope includes the parameters. For
22 * classes and typedefs, the scope includes the type variables.
23 * For classes and class members, the scope includes inherited members.
24 *
25 * See also:
26 *
27 * * [Lexical Scope](https://www.dartlang.org/docs/dart-up-and-running/content s/ch02.html#ch02-lexical-scope)
28 * in Dart Up and Running.
29 * * [Lexical Scoping](http://www.dartlang.org/docs/spec/latest/dart-language- specification.html#h.jb82efuudrc5)
30 * in the Dart Specification.
31 */
32 DeclarationMirror lookupInScope(String name);
33 }
34
35 /**
36 * Specialized [InstanceMirror] used for reflection on constant lists.
37 */
38 abstract class ListInstanceMirror implements InstanceMirror {
39 /**
40 * Returns an instance mirror of the value at [index] or throws a [RangeError]
41 * if the [index] is out of bounds.
42 */
43 InstanceMirror getElement(int index);
44
45 /**
46 * The number of elements in the list.
47 */
48 int get length;
49 }
50
51 /**
52 * Specialized [InstanceMirror] used for reflection on constant maps.
53 */
54 abstract class MapInstanceMirror implements InstanceMirror {
55 /**
56 * Returns a collection containing all the keys in the map.
57 */
58 Iterable<String> get keys;
59
60 /**
61 * Returns an instance mirror of the value for the given key or
62 * null if key is not in the map.
63 */
64 InstanceMirror getValue(String key);
65
66 /**
67 * The number of {key, value} pairs in the map.
68 */
69 int get length;
70 }
71
72 /**
73 * Specialized [InstanceMirror] used for reflection on type constants.
74 */
75 abstract class TypeInstanceMirror implements InstanceMirror {
76 /**
77 * Returns the type mirror for the type represented by the reflected type
78 * constant.
79 */
80 TypeMirror get representedType;
81 }
82
83 /**
84 * Specialized [InstanceMirror] used for reflection on comments as metadata.
85 */
86 abstract class CommentInstanceMirror implements InstanceMirror {
87 /**
88 * The comment text as written in the source text.
89 */
90 String get text;
91
92 /**
93 * The comment text without the start, end, and padding text.
94 *
95 * For example, if [text] is [: /** Comment text. */ :] then the [trimmedText]
96 * is [: Comment text. :].
97 */
98 String get trimmedText;
99
100 /**
101 * Is [:true:] if this comment is a documentation comment.
102 *
103 * That is, that the comment is either enclosed in [: /** ... */ :] or starts
104 * with [: /// :].
105 */
106 bool get isDocComment;
107 }
108
109 /**
110 * A library.
111 */
112 abstract class LibrarySourceMirror
113 implements DeclarationSourceMirror, LibraryMirror {
114 /**
115 * Returns a list of the imports and exports in this library;
116 */
117 List<LibraryDependencyMirror> get libraryDependencies;
118 }
119
120 /// A mirror on an import or export declaration.
121 abstract class LibraryDependencySourceMirror extends Mirror
122 implements LibraryDependencyMirror {
123 /// Is `true` if this dependency is an import.
124 bool get isImport;
125
126 /// Is `true` if this dependency is an export.
127 bool get isExport;
128
129 /// Returns the library mirror of the library that imports or exports the
130 /// [targetLibrary].
131 LibraryMirror get sourceLibrary;
132
133 /// Returns the library mirror of the library that is imported or exported.
134 LibraryMirror get targetLibrary;
135
136 /// Returns the prefix if this is a prefixed import and `null` otherwise.
137 /*String*/ get prefix;
138
139 /// Returns the list of show/hide combinators on the import/export
140 /// declaration.
141 List<CombinatorMirror> get combinators;
142
143 /// Returns the source location for this import/export declaration.
144 SourceLocation get location;
145
146 /// Returns a future that completes when the library is loaded and initates a
147 /// load if one has not already happened.
148 /*Future<LibraryMirror>*/ loadLibrary();
149 }
150
151 /// A mirror on a show/hide combinator declared on a library dependency.
152 abstract class CombinatorSourceMirror extends Mirror
153 implements CombinatorMirror {
154 /// The list of identifiers on the combinator.
155 List/*<String>*/ get identifiers;
156
157 /// Is `true` if this is a 'show' combinator.
158 bool get isShow;
159
160 /// Is `true` if this is a 'hide' combinator.
161 bool get isHide;
162 }
163
164 /**
165 * Common interface for classes, interfaces, typedefs and type variables.
166 */
167 abstract class TypeSourceMirror implements DeclarationSourceMirror, TypeMirror {
168 /// Returns `true` is this is a mirror on the void type.
169 bool get isVoid;
170
171 /// Returns `true` is this is a mirror on the dynamic type.
172 bool get isDynamic;
173
174 /// Create a type mirror on the instantiation of the declaration of this type
175 /// with [typeArguments] as type arguments.
176 TypeMirror createInstantiation(List<TypeMirror> typeArguments);
177 }
178
179 /**
180 * A class or interface type.
181 */
182 abstract class ClassSourceMirror implements TypeSourceMirror, ClassMirror {
183 /**
184 * Is [:true:] if this class is declared abstract.
185 */
186 bool get isAbstract;
187 }
188
189 /**
190 * A formal parameter.
191 */
192 abstract class ParameterSourceMirror implements ParameterMirror {
193 /**
194 * Returns [:true:] iff this parameter is an initializing formal of a
195 * constructor. That is, if it is of the form [:this.x:] where [:x:] is a
196 * field.
197 */
198 bool get isInitializingFormal;
199
200 /**
201 * Returns the initialized field, if this parameter is an initializing formal.
202 */
203 VariableMirror get initializedField;
204 }
205
206 /**
207 * A [SourceLocation] describes the span of an entity in Dart source code.
208 * A [SourceLocation] with a non-zero [length] should be the minimum span that
209 * encloses the declaration of the mirrored entity.
210 */
211 abstract class SourceLocation implements api.SourceLocation {
212 /**
213 * The 1-based line number for this source location.
214 *
215 * A value of 0 means that the line number is unknown.
216 */
217 int get line;
218
219 /**
220 * The 1-based column number for this source location.
221 *
222 * A value of 0 means that the column number is unknown.
223 */
224 int get column;
225
226 /**
227 * The 0-based character offset into the [sourceText] where this source
228 * location begins.
229 *
230 * A value of -1 means that the offset is unknown.
231 */
232 int get offset;
233
234 /**
235 * The number of characters in this source location.
236 *
237 * A value of 0 means that the [offset] is approximate.
238 */
239 int get length;
240
241 /**
242 * The text of the location span.
243 */
244 String get text;
245
246 /**
247 * Returns the URI where the source originated.
248 */
249 Uri get sourceUri;
250
251 /**
252 * Returns the text of this source.
253 */
254 String get sourceText;
255 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/mirrors/mirrors_util.dart ('k') | tests/compiler/dart2js/analyze_test_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698