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

Side by Side Diff: lib/mirrors/mirrors.dart

Issue 10917187: First partial step at removing interfaces in libraries. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « lib/core/regexp.dart ('k') | tests/co19/co19-compiler.status » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 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 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 // The dart:mirrors library provides reflective access for Dart program. 5 // The dart:mirrors library provides reflective access for Dart program.
6 // 6 //
7 // For the purposes of the mirrors library, we adopt a naming 7 // For the purposes of the mirrors library, we adopt a naming
8 // convention with respect to getters and setters. Specifically, for 8 // convention with respect to getters and setters. Specifically, for
9 // some variable or field... 9 // some variable or field...
10 // 10 //
(...skipping 10 matching lines...) Expand all
21 * associated libraries. 21 * associated libraries.
22 * 22 *
23 * At runtime each running isolate has a distinct [MirrorSystem]. 23 * At runtime each running isolate has a distinct [MirrorSystem].
24 * 24 *
25 * It is also possible to have a [MirrorSystem] which represents a set 25 * It is also possible to have a [MirrorSystem] which represents a set
26 * of libraries which are not running -- perhaps at compile-time. In 26 * of libraries which are not running -- perhaps at compile-time. In
27 * this case, all available reflective functionality would be 27 * this case, all available reflective functionality would be
28 * supported, but runtime functionality (such as invoking a function 28 * supported, but runtime functionality (such as invoking a function
29 * or inspecting the contents of a variable) would fail dynamically. 29 * or inspecting the contents of a variable) would fail dynamically.
30 */ 30 */
31 interface MirrorSystem { 31 abstract class MirrorSystem {
32 /** 32 /**
33 * An immutable map from from library names to mirrors for all 33 * An immutable map from from library names to mirrors for all
34 * libraries known to this mirror system. 34 * libraries known to this mirror system.
35 */ 35 */
36 final Map<String, LibraryMirror> libraries; 36 Map<String, LibraryMirror> get libraries;
37 37
38 /** 38 /**
39 * A mirror on the isolate associated with this [MirrorSystem]. 39 * A mirror on the isolate associated with this [MirrorSystem].
40 * This may be null if this mirror system is not running. 40 * This may be null if this mirror system is not running.
41 */ 41 */
42 final IsolateMirror isolate; 42 IsolateMirror get isolate;
43 43
44 /** 44 /**
45 * A mirror on the [:Dynamic:] type. 45 * A mirror on the [:Dynamic:] type.
46 */ 46 */
47 final TypeMirror dynamicType; 47 TypeMirror get dynamicType;
48 48
49 /** 49 /**
50 * A mirror on the [:void:] type. 50 * A mirror on the [:void:] type.
51 */ 51 */
52 final TypeMirror voidType; 52 TypeMirror get voidType;
53 } 53 }
54 54
55 /** 55 /**
56 * Returns a [MirrorSystem] for the current isolate. 56 * Returns a [MirrorSystem] for the current isolate.
57 */ 57 */
58 MirrorSystem currentMirrorSystem() { 58 MirrorSystem currentMirrorSystem() {
59 return _Mirrors.currentMirrorSystem(); 59 return _Mirrors.currentMirrorSystem();
60 } 60 }
61 61
62 /** 62 /**
(...skipping 12 matching lines...) Expand all
75 */ 75 */
76 InstanceMirror reflect(Object reflectee) { 76 InstanceMirror reflect(Object reflectee) {
77 return _Mirrors.reflect(reflectee); 77 return _Mirrors.reflect(reflectee);
78 } 78 }
79 79
80 /** 80 /**
81 * A [Mirror] reflects some Dart language entity. 81 * A [Mirror] reflects some Dart language entity.
82 * 82 *
83 * Every [Mirror] originates from some [MirrorSystem]. 83 * Every [Mirror] originates from some [MirrorSystem].
84 */ 84 */
85 interface Mirror extends Hashable { 85 abstract class Mirror implements Hashable {
86 /** 86 /**
87 * The [MirrorSystem] that contains this mirror. 87 * The [MirrorSystem] that contains this mirror.
88 */ 88 */
89 final MirrorSystem mirrors; 89 MirrorSystem get mirrors;
90 } 90 }
91 91
92 /** 92 /**
93 * An [IsolateMirror] reflects an isolate. 93 * An [IsolateMirror] reflects an isolate.
94 */ 94 */
95 interface IsolateMirror extends Mirror { 95 abstract class IsolateMirror implements Mirror {
96 /** 96 /**
97 * A unique name used to refer to an isolate in debugging messages. 97 * A unique name used to refer to an isolate in debugging messages.
98 */ 98 */
99 final String debugName; 99 String get debugName;
100 100
101 /** 101 /**
102 * Does this mirror reflect the currently running isolate? 102 * Does this mirror reflect the currently running isolate?
103 */ 103 */
104 final bool isCurrent; 104 bool get isCurrent;
105 105
106 /** 106 /**
107 * A mirror on the root library for this isolate. 107 * A mirror on the root library for this isolate.
108 */ 108 */
109 final LibraryMirror rootLibrary; 109 LibraryMirror get rootLibrary;
110 } 110 }
111 111
112 /** 112 /**
113 * A [DeclarationMirror] reflects some entity declared in a Dart program. 113 * A [DeclarationMirror] reflects some entity declared in a Dart program.
114 */ 114 */
115 interface DeclarationMirror extends Mirror { 115 abstract class DeclarationMirror implements Mirror {
116 /** 116 /**
117 * The simple name for this Dart language entity. 117 * The simple name for this Dart language entity.
118 * 118 *
119 * The simple name is in most cases the the identifier name of the 119 * The simple name is in most cases the the identifier name of the
120 * entity, such as 'method' for a method [:void method() {...}:] or 120 * entity, such as 'method' for a method [:void method() {...}:] or
121 * 'mylibrary' for a [:#library('mylibrary');:] declaration. 121 * 'mylibrary' for a [:#library('mylibrary');:] declaration.
122 */ 122 */
123 final String simpleName; 123 String get simpleName;
124 124
125 /** 125 /**
126 * The fully-qualified name for this Dart language entity. 126 * The fully-qualified name for this Dart language entity.
127 * 127 *
128 * This name is qualified by the name of the owner. For instance, 128 * This name is qualified by the name of the owner. For instance,
129 * the qualified name of a method 'method' in class 'Class' in 129 * the qualified name of a method 'method' in class 'Class' in
130 * library 'library' is 'library.Class.method'. 130 * library 'library' is 'library.Class.method'.
131 * 131 *
132 * TODO(turnidge): Specify whether this name is unique. Currently 132 * TODO(turnidge): Specify whether this name is unique. Currently
133 * this is a gray area due to lack of clarity over whether library 133 * this is a gray area due to lack of clarity over whether library
134 * names are unique. 134 * names are unique.
135 */ 135 */
136 final String qualifiedName; 136 String get qualifiedName;
137 137
138 /** 138 /**
139 * A mirror on the owner of this function. This is the declaration 139 * A mirror on the owner of this function. This is the declaration
140 * immediately surrounding the reflectee. 140 * immediately surrounding the reflectee.
141 * 141 *
142 * Note that for libraries, the owner will be [:null:]. 142 * Note that for libraries, the owner will be [:null:].
143 */ 143 */
144 final DeclarationMirror owner; 144 DeclarationMirror get owner;
145 145
146 /** 146 /**
147 * Is this declaration private? 147 * Is this declaration private?
148 * 148 *
149 * Note that for libraries, this will be [:false:]. 149 * Note that for libraries, this will be [:false:].
150 */ 150 */
151 final bool isPrivate; 151 bool get isPrivate;
152 152
153 /** 153 /**
154 * Is this declaration top-level? 154 * Is this declaration top-level?
155 * 155 *
156 * This is defined to be equivalent to: 156 * This is defined to be equivalent to:
157 * [:mirror.owner !== null && mirror.owner is LibraryMirror:] 157 * [:mirror.owner !== null && mirror.owner is LibraryMirror:]
158 */ 158 */
159 final bool isTopLevel; 159 bool get isTopLevel;
160 160
161 /** 161 /**
162 * The source location of this Dart language entity. 162 * The source location of this Dart language entity.
163 */ 163 */
164 final SourceLocation location; 164 SourceLocation get location;
165 } 165 }
166 166
167 /** 167 /**
168 * An [ObjectMirror] is a common superinterface of [InstanceMirror], 168 * An [ObjectMirror] is a common superinterface of [InstanceMirror],
169 * [ClassMirror], and [LibraryMirror] that represents their shared 169 * [ClassMirror], and [LibraryMirror] that represents their shared
170 * functionality. 170 * functionality.
171 * 171 *
172 * For the purposes of the mirrors library, these types are all 172 * For the purposes of the mirrors library, these types are all
173 * object-like, in that they support method invocation and field 173 * object-like, in that they support method invocation and field
174 * access. Real Dart objects are represented by the [InstanceMirror] 174 * access. Real Dart objects are represented by the [InstanceMirror]
175 * type. 175 * type.
176 * 176 *
177 * See [InstanceMirror], [ClassMirror], and [LibraryMirror]. 177 * See [InstanceMirror], [ClassMirror], and [LibraryMirror].
178 */ 178 */
179 interface ObjectMirror extends Mirror { 179 abstract class ObjectMirror implements Mirror {
180 /** 180 /**
181 * Invokes the named function and returns a mirror on the result. 181 * Invokes the named function and returns a mirror on the result.
182 * 182 *
183 * TODO(turnidge): Properly document. 183 * TODO(turnidge): Properly document.
184 * TODO(turnidge): Handle ambiguous names. 184 * TODO(turnidge): Handle ambiguous names.
185 * TODO(turnidge): Handle optional & named arguments. 185 * TODO(turnidge): Handle optional & named arguments.
186 */ 186 */
187 Future<InstanceMirror> invoke(String memberName, 187 Future<InstanceMirror> invoke(String memberName,
188 List<Object> positionalArguments, 188 List<Object> positionalArguments,
189 [Map<String,Object> namedArguments]); 189 [Map<String,Object> namedArguments]);
(...skipping 13 matching lines...) Expand all
203 * user-defined setter method. 203 * user-defined setter method.
204 * 204 *
205 * TODO(turnidge): Handle ambiguous names. 205 * TODO(turnidge): Handle ambiguous names.
206 */ 206 */
207 Future<InstanceMirror> setField(String fieldName, Object value); 207 Future<InstanceMirror> setField(String fieldName, Object value);
208 } 208 }
209 209
210 /** 210 /**
211 * An [InstanceMirror] reflects an instance of a Dart language object. 211 * An [InstanceMirror] reflects an instance of a Dart language object.
212 */ 212 */
213 interface InstanceMirror extends ObjectMirror { 213 abstract class InstanceMirror implements ObjectMirror {
214 /** 214 /**
215 * A mirror on the type of the reflectee. 215 * A mirror on the type of the reflectee.
216 */ 216 */
217 final ClassMirror type; 217 ClassMirror get type;
218 218
219 /** 219 /**
220 * Does [reflectee] contain the instance reflected by this mirror? 220 * Does [reflectee] contain the instance reflected by this mirror?
221 * This will always be true in the local case (reflecting instances 221 * This will always be true in the local case (reflecting instances
222 * in the same isolate), but only true in the remote case if this 222 * in the same isolate), but only true in the remote case if this
223 * mirror reflects a simple value. 223 * mirror reflects a simple value.
224 * 224 *
225 * A value is simple if one of the following holds: 225 * A value is simple if one of the following holds:
226 * - the value is null 226 * - the value is null
227 * - the value is of type [num] 227 * - the value is of type [num]
228 * - the value is of type [bool] 228 * - the value is of type [bool]
229 * - the value is of type [String] 229 * - the value is of type [String]
230 */ 230 */
231 final bool hasReflectee; 231 bool get hasReflectee;
232 232
233 /** 233 /**
234 * If the [InstanceMirror] reflects an instance it is meaningful to 234 * If the [InstanceMirror] reflects an instance it is meaningful to
235 * have a local reference to, we provide access to the actual 235 * have a local reference to, we provide access to the actual
236 * instance here. 236 * instance here.
237 * 237 *
238 * If you access [reflectee] when [hasReflectee] is false, an 238 * If you access [reflectee] when [hasReflectee] is false, an
239 * exception is thrown. 239 * exception is thrown.
240 */ 240 */
241 final reflectee; 241 get reflectee;
242 } 242 }
243 243
244 /** 244 /**
245 * A [ClosureMirror] reflects a closure. 245 * A [ClosureMirror] reflects a closure.
246 * 246 *
247 * A [ClosureMirror] provides access to its captured variables and 247 * A [ClosureMirror] provides access to its captured variables and
248 * provides the ability to execute its reflectee. 248 * provides the ability to execute its reflectee.
249 */ 249 */
250 interface ClosureMirror extends InstanceMirror { 250 abstract class ClosureMirror implements InstanceMirror {
251 /** 251 /**
252 * A mirror on the function associated with this closure. 252 * A mirror on the function associated with this closure.
253 */ 253 */
254 final MethodMirror function; 254 MethodMirror get function;
255 255
256 /** 256 /**
257 * The source code for this closure, if available. Otherwise null. 257 * The source code for this closure, if available. Otherwise null.
258 * 258 *
259 * TODO(turnidge): Would this just be available in function? 259 * TODO(turnidge): Would this just be available in function?
260 */ 260 */
261 final String source; 261 String get source;
262 262
263 /** 263 /**
264 * Executes the closure. The arguments given in the descriptor need to 264 * Executes the closure. The arguments given in the descriptor need to
265 * be InstanceMirrors or simple values. 265 * be InstanceMirrors or simple values.
266 * 266 *
267 * A value is simple if one of the following holds: 267 * A value is simple if one of the following holds:
268 * - the value is null 268 * - the value is null
269 * - the value is of type [num] 269 * - the value is of type [num]
270 * - the value is of type [bool] 270 * - the value is of type [bool]
271 * - the value is of type [String] 271 * - the value is of type [String]
272 */ 272 */
273 Future<InstanceMirror> apply(List<Object> positionalArguments, 273 Future<InstanceMirror> apply(List<Object> positionalArguments,
274 [Map<String,Object> namedArguments]); 274 [Map<String,Object> namedArguments]);
275 275
276 /** 276 /**
277 * Looks up the value of a name in the scope of the closure. The 277 * Looks up the value of a name in the scope of the closure. The
278 * result is a mirror on that value. 278 * result is a mirror on that value.
279 */ 279 */
280 Future<InstanceMirror> findInContext(String name); 280 Future<InstanceMirror> findInContext(String name);
281 } 281 }
282 282
283 /** 283 /**
284 * A [LibraryMirror] reflects a Dart language library, providing 284 * A [LibraryMirror] reflects a Dart language library, providing
285 * access to the variables, functions, classes, and interfaces of the 285 * access to the variables, functions, and classes of the
286 * library. 286 * library.
287 */ 287 */
288 interface LibraryMirror extends DeclarationMirror, ObjectMirror { 288 abstract class LibraryMirror implements DeclarationMirror, ObjectMirror {
289 /** 289 /**
290 * The url of the library. 290 * The url of the library.
291 * 291 *
292 * TODO(turnidge): Document where this url comes from. Will this 292 * TODO(turnidge): Document where this url comes from. Will this
293 * value be sensible? 293 * value be sensible?
294 */ 294 */
295 final String url; 295 String get url;
296 296
297 /** 297 /**
298 * An immutable map from from names to mirrors for all members in 298 * An immutable map from from names to mirrors for all members in
299 * this library. 299 * this library.
300 * 300 *
301 * The members of a library are its top-level classes, interfaces, 301 * The members of a library are its top-level classes,
302 * functions, variables, getters, and setters. 302 * functions, variables, getters, and setters.
303 */ 303 */
304 final Map<String, Mirror> members; 304 Map<String, Mirror> get members;
305 305
306 /** 306 /**
307 * An immutable map from names to mirrors for all class and 307 * An immutable map from names to mirrors for all class
308 * interface declarations in this library. 308 * declarations in this library.
309 */ 309 */
310 final Map<String, ClassMirror> classes; 310 Map<String, ClassMirror> get classes;
311 311
312 /** 312 /**
313 * An immutable map from names to mirrors for all function, getter, 313 * An immutable map from names to mirrors for all function, getter,
314 * and setter declarations in this library. 314 * and setter declarations in this library.
315 */ 315 */
316 final Map<String, MethodMirror> functions; 316 Map<String, MethodMirror> get functions;
317 317
318 /** 318 /**
319 * An immutable map from names to mirrors for all getter 319 * An immutable map from names to mirrors for all getter
320 * declarations in this library. 320 * declarations in this library.
321 */ 321 */
322 final Map<String, MethodMirror> getters; 322 Map<String, MethodMirror> get getters;
323 323
324 /** 324 /**
325 * An immutable map from names to mirrors for all setter 325 * An immutable map from names to mirrors for all setter
326 * declarations in this library. 326 * declarations in this library.
327 */ 327 */
328 final Map<String, MethodMirror> setters; 328 Map<String, MethodMirror> get setters;
329 329
330 /** 330 /**
331 * An immutable map from names to mirrors for all variable 331 * An immutable map from names to mirrors for all variable
332 * declarations in this library. 332 * declarations in this library.
333 */ 333 */
334 final Map<String, VariableMirror> variables; 334 Map<String, VariableMirror> get variables;
335 } 335 }
336 336
337 /** 337 /**
338 * A [TypeMirror] reflects a Dart language class, interface, typedef 338 * A [TypeMirror] reflects a Dart language class, typedef
339 * or type variable. 339 * or type variable.
340 */ 340 */
341 interface TypeMirror extends DeclarationMirror { 341 abstract class TypeMirror implements DeclarationMirror {
342 } 342 }
343 343
344 /** 344 /**
345 * A [ClassMirror] reflects a Dart language class or interface. 345 * A [ClassMirror] reflects a Dart language class.
346 */ 346 */
347 interface ClassMirror extends TypeMirror, ObjectMirror { 347 abstract class ClassMirror implements TypeMirror, ObjectMirror {
348 /** 348 /**
349 * A mirror on the superclass on the reflectee. 349 * A mirror on the superclass on the reflectee.
350 * 350 *
351 * If this type is [:Object:] or a typedef, the superClass will be 351 * If this type is [:Object:] or a typedef, the superClass will be
352 * null. For interfaces, the superclass is Object. 352 * null.
353 */ 353 */
354 final ClassMirror superclass; 354 ClassMirror get superclass;
355 355
356 /** 356 /**
357 * A list of mirrors on the superinterfaces of the reflectee. 357 * A list of mirrors on the superinterfaces of the reflectee.
358 */ 358 */
359 final List<ClassMirror> superinterfaces; 359 List<ClassMirror> get superinterfaces;
360 360
361 /** 361 /**
362 * An immutable map from from names to mirrors for all members of 362 * An immutable map from from names to mirrors for all members of
363 * this type. 363 * this type.
364 * 364 *
365 * The members of an interface are its constructors, methods,
366 * fields, getters, and setters.
367 *
368 * This does not include inherited members. 365 * This does not include inherited members.
369 */ 366 */
370 final Map<String, Mirror> members; 367 Map<String, Mirror> get members;
371 368
372 /** 369 /**
373 * An immutable map from names to mirrors for all method, 370 * An immutable map from names to mirrors for all method,
374 * constructor, getter, and setter declarations for this type. 371 * constructor, getter, and setter declarations for this type.
375 */ 372 */
376 final Map<String, MethodMirror> methods; 373 Map<String, MethodMirror> get methods;
377 374
378 /** 375 /**
379 * An immutable map from names to mirrors for all constructor 376 * An immutable map from names to mirrors for all constructor
380 * declarations for this type. 377 * declarations for this type.
381 */ 378 */
382 final Map<String, MethodMirror> constructors; 379 Map<String, MethodMirror> get constructors;
383 380
384 /** 381 /**
385 * An immutable map from names to mirrors for all getter 382 * An immutable map from names to mirrors for all getter
386 * declarations for this type. 383 * declarations for this type.
387 */ 384 */
388 final Map<String, MethodMirror> getters; 385 Map<String, MethodMirror> get getters;
389 386
390 /** 387 /**
391 * An immutable map from names to mirrors for all setter 388 * An immutable map from names to mirrors for all setter
392 * declarations for this type. 389 * declarations for this type.
393 */ 390 */
394 final Map<String, MethodMirror> setters; 391 Map<String, MethodMirror> get setters;
395 392
396 /** 393 /**
397 * An immutable map from names to mirrors for all variable 394 * An immutable map from names to mirrors for all variable
398 * declarations for this type. 395 * declarations for this type.
399 */ 396 */
400 final Map<String, VariableMirror> variables; 397 Map<String, VariableMirror> get variables;
401 398
402 /** 399 /**
403 * A list of type variables for this type. 400 * A list of type variables for this type.
404 */ 401 */
405 final List<TypeVariableMirror> typeVariables; 402 List<TypeVariableMirror> get typeVariables;
406 403
407 /** 404 /**
408 * A list of the type arguments for this type. 405 * A list of the type arguments for this type.
409 */ 406 */
410 final List<TypeMirror> typeArguments; 407 List<TypeMirror> get typeArguments;
411 408
412 /** 409 /**
413 * Is this the original declaration of this type? 410 * Is this the original declaration of this type?
414 * 411 *
415 * For most classes, they are their own original declaration. For 412 * For most classes, they are their own original declaration. For
416 * generic classes, however, there is a distinction between the 413 * generic classes, however, there is a distinction between the
417 * original class declaration, which has unbound type variables, and 414 * original class declaration, which has unbound type variables, and
418 * the instantiations of generic classes, which have bound type 415 * the instantiations of generic classes, which have bound type
419 * variables. 416 * variables.
420 */ 417 */
421 final bool isOriginalDeclaration; 418 bool get isOriginalDeclaration;
422 419
423 /** 420 /**
424 * A mirror on the original declaration of this type. 421 * A mirror on the original declaration of this type.
425 * 422 *
426 * For most classes, they are their own original declaration. For 423 * For most classes, they are their own original declaration. For
427 * generic classes, however, there is a distinction between the 424 * generic classes, however, there is a distinction between the
428 * original class declaration, which has unbound type variables, and 425 * original class declaration, which has unbound type variables, and
429 * the instantiations of generic classes, which have bound type 426 * the instantiations of generic classes, which have bound type
430 * variables. 427 * variables.
431 */ 428 */
432 final ClassMirror originalDeclaration; 429 ClassMirror get originalDeclaration;
433 430
434 /** 431 /**
435 * Invokes the named constructor and returns a mirror on the result. 432 * Invokes the named constructor and returns a mirror on the result.
436 * 433 *
437 * TODO(turnidge): Properly document. 434 * TODO(turnidge): Properly document.
438 */ 435 */
439 Future<InstanceMirror> newInstance(String constructorName, 436 Future<InstanceMirror> newInstance(String constructorName,
440 List<Object> positionalArguments, 437 List<Object> positionalArguments,
441 [Map<String,Object> namedArguments]); 438 [Map<String,Object> namedArguments]);
442 439
443 /** 440 /**
444 * Does this mirror represent a class? 441 * Does this mirror represent a class?
445 * 442 *
446 * TODO(turnidge): This functions goes away after the 443 * TODO(turnidge): This functions goes away after the
447 * class/interface changes. 444 * class/interface changes.
448 */ 445 */
449 final bool isClass; 446 bool get isClass;
450 447
451 /** 448 /**
452 * A mirror on the default factory class or null if there is none. 449 * A mirror on the default factory class or null if there is none.
453 * 450 *
454 * TODO(turnidge): This functions goes away after the 451 * TODO(turnidge): This functions goes away after the
455 * class/interface changes. 452 * class/interface changes.
456 */ 453 */
457 final ClassMirror defaultFactory; 454 ClassMirror get defaultFactory;
458 } 455 }
459 456
460 /** 457 /**
461 * A [TypeVariableMirror] represents a type parameter of a generic 458 * A [TypeVariableMirror] represents a type parameter of a generic
462 * type. 459 * type.
463 */ 460 */
464 interface TypeVariableMirror extends TypeMirror { 461 abstract class TypeVariableMirror implements TypeMirror {
465 /** 462 /**
466 * A mirror on the type that is the upper bound for this type variable. 463 * A mirror on the type that is the upper bound for this type variable.
467 */ 464 */
468 final TypeMirror upperBound; 465 TypeMirror get upperBound;
469 } 466 }
470 467
471 /** 468 /**
472 * A [FunctionTypeMirror] represents the type of a function in the 469 * A [FunctionTypeMirror] represents the type of a function in the
473 * Dart language. 470 * Dart language.
474 */ 471 */
475 interface FunctionTypeMirror extends TypeMirror { 472 abstract class FunctionTypeMirror implements TypeMirror {
476 /** 473 /**
477 * The return type of the reflectee. 474 * The return type of the reflectee.
478 */ 475 */
479 final TypeMirror returnType; 476 TypeMirror get returnType;
480 477
481 /** 478 /**
482 * A list of the parameter types of the reflectee. 479 * A list of the parameter types of the reflectee.
483 */ 480 */
484 final List<ParameterMirror> parameters; 481 List<ParameterMirror> get parameters;
485 482
486 /** 483 /**
487 * A mirror on the [:call:] method for the reflectee. 484 * A mirror on the [:call:] method for the reflectee.
488 * 485 *
489 * TODO(turnidge): What is this and what is it for? 486 * TODO(turnidge): What is this and what is it for?
490 */ 487 */
491 final MethodMirror callMethod; 488 MethodMirror get callMethod;
492 } 489 }
493 490
494 /** 491 /**
495 * A [TypedefMirror] represents a typedef in a Dart language program. 492 * A [TypedefMirror] represents a typedef in a Dart language program.
496 */ 493 */
497 interface TypedefMirror extends ClassMirror { 494 abstract class TypedefMirror implements ClassMirror {
498 /** 495 /**
499 * The defining type for this typedef. 496 * The defining type for this typedef.
500 * 497 *
501 * For instance [:void f(int):] is the value for [:typedef void f(int):]. 498 * For instance [:void f(int):] is the value for [:typedef void f(int):].
502 */ 499 */
503 final TypeMirror value; 500 TypeMirror get value;
504 } 501 }
505 502
506 /** 503 /**
507 * A [MethodMirror] reflects a Dart language function, method, 504 * A [MethodMirror] reflects a Dart language function, method,
508 * constructor, getter, or setter. 505 * constructor, getter, or setter.
509 */ 506 */
510 interface MethodMirror extends DeclarationMirror { 507 abstract class MethodMirror implements DeclarationMirror {
511 /** 508 /**
512 * A mirror on the return type for the reflectee. 509 * A mirror on the return type for the reflectee.
513 */ 510 */
514 final TypeMirror returnType; 511 TypeMirror get returnType;
515 512
516 /** 513 /**
517 * A list of mirrors on the parameters for the reflectee. 514 * A list of mirrors on the parameters for the reflectee.
518 */ 515 */
519 final List<ParameterMirror> parameters; 516 List<ParameterMirror> get parameters;
520 517
521 /** 518 /**
522 * Is the reflectee static? 519 * Is the reflectee static?
523 * 520 *
524 * For the purposes of the mirrors library, a top-level function is 521 * For the purposes of the mirrors library, a top-level function is
525 * considered static. 522 * considered static.
526 */ 523 */
527 final bool isStatic; 524 bool get isStatic;
528 525
529 /** 526 /**
530 * Is the reflectee abstract? 527 * Is the reflectee abstract?
531 */ 528 */
532 final bool isAbstract; 529 bool get isAbstract;
533 530
534 /** 531 /**
535 * Is the reflectee a regular function or method? 532 * Is the reflectee a regular function or method?
536 * 533 *
537 * A function or method is regular if it is not a getter, setter, or 534 * A function or method is regular if it is not a getter, setter, or
538 * constructor. Note that operators, by this definition, are 535 * constructor. Note that operators, by this definition, are
539 * regular methods. 536 * regular methods.
540 */ 537 */
541 final bool isRegularMethod; 538 bool get isRegularMethod;
542 539
543 /** 540 /**
544 * Is the reflectee an operator? 541 * Is the reflectee an operator?
545 */ 542 */
546 final bool isOperator; 543 bool get isOperator;
547 544
548 /** 545 /**
549 * Is the reflectee a getter? 546 * Is the reflectee a getter?
550 */ 547 */
551 final bool isGetter; 548 bool get isGetter;
552 549
553 /** 550 /**
554 * Is the reflectee a setter? 551 * Is the reflectee a setter?
555 */ 552 */
556 final bool isSetter; 553 bool get isSetter;
557 554
558 /** 555 /**
559 * Is the reflectee a constructor? 556 * Is the reflectee a constructor?
560 */ 557 */
561 final bool isConstructor; 558 bool get isConstructor;
562 559
563 /** 560 /**
564 * The constructor name for named constructors and factory methods. 561 * The constructor name for named constructors and factory methods.
565 * 562 *
566 * For unnamed constructors, this is the empty string. For 563 * For unnamed constructors, this is the empty string. For
567 * non-constructors, this is the empty string. 564 * non-constructors, this is the empty string.
568 * 565 *
569 * For example, [:'bar':] is the constructor name for constructor 566 * For example, [:'bar':] is the constructor name for constructor
570 * [:Foo.bar:] of type [:Foo:]. 567 * [:Foo.bar:] of type [:Foo:].
571 */ 568 */
572 final String constructorName; 569 String get constructorName;
573 570
574 /** 571 /**
575 * Is the reflectee a const constructor? 572 * Is the reflectee a const constructor?
576 */ 573 */
577 final bool isConstConstructor; 574 bool get isConstConstructor;
578 575
579 /** 576 /**
580 * Is the reflectee a generative constructor? 577 * Is the reflectee a generative constructor?
581 */ 578 */
582 final bool isGenerativeConstructor; 579 bool get isGenerativeConstructor;
583 580
584 /** 581 /**
585 * Is the reflectee a redirecting constructor? 582 * Is the reflectee a redirecting constructor?
586 */ 583 */
587 final bool isRedirectingConstructor; 584 bool get isRedirectingConstructor;
588 585
589 /** 586 /**
590 * Is the reflectee a factory constructor? 587 * Is the reflectee a factory constructor?
591 */ 588 */
592 final bool isFactoryConstructor; 589 bool get isFactoryConstructor;
593 } 590 }
594 591
595 /** 592 /**
596 * A [VariableMirror] reflects a Dart language variable declaration. 593 * A [VariableMirror] reflects a Dart language variable declaration.
597 */ 594 */
598 interface VariableMirror extends DeclarationMirror { 595 abstract class VariableMirror implements DeclarationMirror {
599 /** 596 /**
600 * A mirror on the type of the reflectee. 597 * A mirror on the type of the reflectee.
601 */ 598 */
602 final TypeMirror type; 599 TypeMirror get type;
603 600
604 /** 601 /**
605 * Is the reflectee a static variable? 602 * Is the reflectee a static variable?
606 * 603 *
607 * For the purposes of the mirror library, top-level variables are 604 * For the purposes of the mirror library, top-level variables are
608 * implicitly declared static. 605 * implicitly declared static.
609 */ 606 */
610 final bool isStatic; 607 bool get isStatic;
611 608
612 /** 609 /**
613 * Is the reflectee a final variable? 610 * Is the reflectee a final variable?
614 */ 611 */
615 final bool isFinal; 612 bool get isFinal;
616 } 613 }
617 614
618 /** 615 /**
619 * A [ParameterMirror] reflects a Dart formal parameter declaration. 616 * A [ParameterMirror] reflects a Dart formal parameter declaration.
620 */ 617 */
621 interface ParameterMirror extends VariableMirror { 618 abstract class ParameterMirror implements VariableMirror {
622 /** 619 /**
623 * A mirror on the type of this parameter. 620 * A mirror on the type of this parameter.
624 */ 621 */
625 final TypeMirror type; 622 TypeMirror get type;
626 623
627 /** 624 /**
628 * Is this parameter optional? 625 * Is this parameter optional?
629 */ 626 */
630 final bool isOptional; 627 bool get isOptional;
631 628
632 /** 629 /**
633 * Is this parameter named? 630 * Is this parameter named?
634 */ 631 */
635 final bool isNamed; 632 bool get isNamed;
636 633
637 /** 634 /**
638 * Does this parameter have a default value? 635 * Does this parameter have a default value?
639 */ 636 */
640 final bool hasDefaultValue; 637 bool get hasDefaultValue;
641 638
642 /** 639 /**
643 * A mirror on the default value for this parameter, if it exists. 640 * A mirror on the default value for this parameter, if it exists.
644 * 641 *
645 * TODO(turnidge): String may not be a good representation of this 642 * TODO(turnidge): String may not be a good representation of this
646 * at runtime. 643 * at runtime.
647 */ 644 */
648 final String defaultValue; 645 String get defaultValue;
649 } 646 }
650 647
651 /** 648 /**
652 * A [SourceLocation] describes the span of an entity in Dart source code. 649 * A [SourceLocation] describes the span of an entity in Dart source code.
653 */ 650 */
654 interface SourceLocation { 651 abstract class SourceLocation {
655 } 652 }
656 653
657 /** 654 /**
658 * When an error occurs during the mirrored execution of code, a 655 * When an error occurs during the mirrored execution of code, a
659 * [MirroredError] is thrown. 656 * [MirroredError] is thrown.
660 * 657 *
661 * In general, there are three main classes of failure that can happen 658 * In general, there are three main classes of failure that can happen
662 * during mirrored execution of code in some isolate: 659 * during mirrored execution of code in some isolate:
663 * 660 *
664 * - An exception is thrown but not caught. This is caught by the 661 * - An exception is thrown but not caught. This is caught by the
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 725
729 /** 726 /**
730 * A [MirrorException] is used to indicate errors within the mirrors 727 * A [MirrorException] is used to indicate errors within the mirrors
731 * framework. 728 * framework.
732 */ 729 */
733 class MirrorException implements Exception { 730 class MirrorException implements Exception {
734 const MirrorException(String this._message); 731 const MirrorException(String this._message);
735 String toString() => "MirrorException: '$_message'"; 732 String toString() => "MirrorException: '$_message'";
736 final String _message; 733 final String _message;
737 } 734 }
OLDNEW
« no previous file with comments | « lib/core/regexp.dart ('k') | tests/co19/co19-compiler.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698