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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/mirrors/source_mirrors.dart

Issue 694353007: Move dart2js from sdk/lib/_internal/compiler to pkg/compiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
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
122 extends Mirror 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
147 /// A mirror on a show/hide combinator declared on a library dependency.
148 abstract class CombinatorSourceMirror
149 extends Mirror implements CombinatorMirror {
150 /// The list of identifiers on the combinator.
151 List/*<String>*/ get identifiers;
152
153 /// Is `true` if this is a 'show' combinator.
154 bool get isShow;
155
156 /// Is `true` if this is a 'hide' combinator.
157 bool get isHide;
158 }
159
160 /**
161 * Common interface for classes, interfaces, typedefs and type variables.
162 */
163 abstract class TypeSourceMirror implements DeclarationSourceMirror, TypeMirror {
164 /// Returns `true` is this is a mirror on the void type.
165 bool get isVoid;
166
167 /// Returns `true` is this is a mirror on the dynamic type.
168 bool get isDynamic;
169
170 /// Create a type mirror on the instantiation of the declaration of this type
171 /// with [typeArguments] as type arguments.
172 TypeMirror createInstantiation(List<TypeMirror> typeArguments);
173 }
174
175 /**
176 * A class or interface type.
177 */
178 abstract class ClassSourceMirror implements TypeSourceMirror, ClassMirror {
179 /**
180 * Is [:true:] if this class is declared abstract.
181 */
182 bool get isAbstract;
183 }
184
185 /**
186 * A formal parameter.
187 */
188 abstract class ParameterSourceMirror implements ParameterMirror {
189 /**
190 * Returns [:true:] iff this parameter is an initializing formal of a
191 * constructor. That is, if it is of the form [:this.x:] where [:x:] is a
192 * field.
193 */
194 bool get isInitializingFormal;
195
196 /**
197 * Returns the initialized field, if this parameter is an initializing formal.
198 */
199 VariableMirror get initializedField;
200 }
201
202 /**
203 * A [SourceLocation] describes the span of an entity in Dart source code.
204 * A [SourceLocation] with a non-zero [length] should be the minimum span that
205 * encloses the declaration of the mirrored entity.
206 */
207 abstract class SourceLocation implements api.SourceLocation {
208 /**
209 * The 1-based line number for this source location.
210 *
211 * A value of 0 means that the line number is unknown.
212 */
213 int get line;
214
215 /**
216 * The 1-based column number for this source location.
217 *
218 * A value of 0 means that the column number is unknown.
219 */
220 int get column;
221
222 /**
223 * The 0-based character offset into the [sourceText] where this source
224 * location begins.
225 *
226 * A value of -1 means that the offset is unknown.
227 */
228 int get offset;
229
230 /**
231 * The number of characters in this source location.
232 *
233 * A value of 0 means that the [offset] is approximate.
234 */
235 int get length;
236
237 /**
238 * The text of the location span.
239 */
240 String get text;
241
242 /**
243 * Returns the URI where the source originated.
244 */
245 Uri get sourceUri;
246
247 /**
248 * Returns the text of this source.
249 */
250 String get sourceText;
251 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698