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

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

Issue 23455028: Mirrors overhaul. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r29550. Created 7 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
« no previous file with comments | « dart/sdk/lib/_internal/pub/lib/src/utils.dart ('k') | dart/tests/co19/co19-analyzer.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 // For the purposes of the mirrors library, we adopt a naming 5 // For the purposes of the mirrors library, we adopt a naming
6 // convention with respect to getters and setters. Specifically, for 6 // convention with respect to getters and setters. Specifically, for
7 // some variable or field... 7 // some variable or field...
8 // 8 //
9 // var myField; 9 // var myField;
10 // 10 //
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 * or inspecting the contents of a variable) would fail dynamically. 64 * or inspecting the contents of a variable) would fail dynamically.
65 */ 65 */
66 abstract class MirrorSystem { 66 abstract class MirrorSystem {
67 /** 67 /**
68 * Returns an immutable map from URIs to mirrors for all 68 * Returns an immutable map from URIs to mirrors for all
69 * libraries known to this mirror system. 69 * libraries known to this mirror system.
70 */ 70 */
71 Map<Uri, LibraryMirror> get libraries; 71 Map<Uri, LibraryMirror> get libraries;
72 72
73 /** 73 /**
74 * Returns an iterable of all libraries in the mirror system whose library 74 * Returns the unique library named [libraryName] if it exists.
75 * name is [libraryName]. 75 *
76 * If no unique library exists, an error is thrown.
76 */ 77 */
77 Iterable<LibraryMirror> findLibrary(Symbol libraryName) { 78 LibraryMirror findLibrary(Symbol libraryName) {
78 return libraries.values.where( 79 return libraries.values.singleWhere(
79 (library) => library.simpleName == libraryName); 80 (library) => library.simpleName == libraryName);
80 } 81 }
81 82
82 /** 83 /**
83 * A mirror on the isolate associated with this [MirrorSystem]. 84 * A mirror on the isolate associated with this [MirrorSystem].
84 * This may be null if this mirror system is not running. 85 * This may be null if this mirror system is not running.
85 */ 86 */
86 IsolateMirror get isolate; 87 IsolateMirror get isolate;
87 88
88 /** 89 /**
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 /** 123 /**
123 * Returns a [MirrorSystem] for the current isolate. 124 * Returns a [MirrorSystem] for the current isolate.
124 */ 125 */
125 external MirrorSystem currentMirrorSystem(); 126 external MirrorSystem currentMirrorSystem();
126 127
127 /** 128 /**
128 * Reflects an instance. 129 * Reflects an instance.
129 * Returns an [InstanceMirror] reflecting [reflectee]. 130 * Returns an [InstanceMirror] reflecting [reflectee].
130 * If [reflectee] is a function or an instance of a class 131 * If [reflectee] is a function or an instance of a class
131 * that has a [:call:] method, the returned instance mirror 132 * that has a [:call:] method, the returned instance mirror
132 * will be a [ClosureMirror]. 133 * will be a [ClosureMirror].
133 * 134 *
134 * Note that since one cannot obtain an object from 135 * Note that since one cannot obtain an object from
135 * another isolate, this function can only be used to 136 * another isolate, this function can only be used to
136 * obtain mirrors on objects of the current isolate. 137 * obtain mirrors on objects of the current isolate.
137 */ 138 */
138 external InstanceMirror reflect(Object reflectee); 139 external InstanceMirror reflect(Object reflectee);
139 140
140 /** 141 /**
141 * Reflects a class declaration. 142 * Reflects a class declaration.
142 * Let *C* be the original class declaration of the class 143 * Let *C* be the original class declaration of the class
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 /** 276 /**
276 * Is this declaration top-level? 277 * Is this declaration top-level?
277 * 278 *
278 * This is defined to be equivalent to: 279 * This is defined to be equivalent to:
279 * [:mirror.owner != null && mirror.owner is LibraryMirror:] 280 * [:mirror.owner != null && mirror.owner is LibraryMirror:]
280 */ 281 */
281 bool get isTopLevel; 282 bool get isTopLevel;
282 283
283 /** 284 /**
284 * The source location of this Dart language entity. 285 * The source location of this Dart language entity.
286 *
287 * This operation is optional and may return [:null:].
285 */ 288 */
286 SourceLocation get location; 289 SourceLocation get location;
287 290
288 /** 291 /**
289 * A list of the metadata associated with this declaration. 292 * A list of the metadata associated with this declaration.
290 * 293 *
291 * Let *D* be the declaration this mirror reflects. 294 * Let *D* be the declaration this mirror reflects.
292 * If *D* is decorated with annotations *A1, ..., An* 295 * If *D* is decorated with annotations *A1, ..., An*
293 * where *n > 0*, then for each annotation *Ai* associated 296 * where *n > 0*, then for each annotation *Ai* associated
294 * with *D, 1 <= i <= n*, let *ci* be the constant object 297 * with *D, 1 <= i <= n*, let *ci* be the constant object
295 * specified by *Ai*. Then this method returns a list whose 298 * specified by *Ai*. Then this method returns a list whose
296 * members are instance mirrors on *c1, ..., cn*. 299 * members are instance mirrors on *c1, ..., cn*.
297 * If no annotations are associated with *D*, then 300 * If no annotations are associated with *D*, then
298 * an empty list is returned. 301 * an empty list is returned.
299 * 302 *
300 * If evaluating any of *c1, ..., cn* would cause a 303 * If evaluating any of *c1, ..., cn* would cause a
301 * compilation error 304 * compilation error
302 * the effect is the same as if a non-reflective compilation error 305 * the effect is the same as if a non-reflective compilation error
303 * had been encountered. 306 * had been encountered.
304 */ 307 */
305 List<InstanceMirror> get metadata; 308 List<InstanceMirror> get metadata;
306 } 309 }
307 310
308 /** 311 /**
309 * An [ObjectMirror] is a common superinterface of [InstanceMirror], 312 * An [ObjectMirror] is a common superinterface of [InstanceMirror],
310 * [ClassMirror], and [LibraryMirror] that represents their shared 313 * [ClassMirror], and [LibraryMirror] that represents their shared
311 * functionality. 314 * functionality.
312 * 315 *
(...skipping 16 matching lines...) Expand all
329 * [namedArguments.keys] 332 * [namedArguments.keys]
330 * and let *v1, ..., vm* be the elements of [namedArguments.values]. 333 * and let *v1, ..., vm* be the elements of [namedArguments.values].
331 * Then this method will perform the method invocation 334 * Then this method will perform the method invocation
332 * *o.f(a1, ..., an, k1: v1, ..., km: vm)* 335 * *o.f(a1, ..., an, k1: v1, ..., km: vm)*
333 * in a scope that has access to the private members 336 * in a scope that has access to the private members
334 * of *o* (if *o* is a class or library) or the private members of the 337 * of *o* (if *o* is a class or library) or the private members of the
335 * class of *o* (otherwise). 338 * class of *o* (otherwise).
336 * If the invocation returns a result *r*, this method returns 339 * If the invocation returns a result *r*, this method returns
337 * the result of calling [reflect](*r*). 340 * the result of calling [reflect](*r*).
338 * If the invocation causes a compilation error 341 * If the invocation causes a compilation error
339 * the effect is the same as if a non-reflective compilation error 342 * the effect is the same as if a non-reflective compilation error
340 * had been encountered. 343 * had been encountered.
341 * If the invocation throws an exception *e* (that it does not catch) 344 * If the invocation throws an exception *e* (that it does not catch)
342 * this method throws *e*. 345 * this method throws *e*.
343 */ 346 */
344 /* 347 /*
345 * TODO(turnidge): Handle ambiguous names. 348 * TODO(turnidge): Handle ambiguous names.
346 * TODO(turnidge): Handle optional & named arguments. 349 * TODO(turnidge): Handle optional & named arguments.
347 */ 350 */
348 InstanceMirror invoke(Symbol memberName, 351 InstanceMirror invoke(Symbol memberName,
349 List positionalArguments, 352 List positionalArguments,
(...skipping 20 matching lines...) Expand all
370 * method in the corresponding library, the result of the invocation is an 373 * method in the corresponding library, the result of the invocation is an
371 * instance mirror on a closure corresponding to that method. 374 * instance mirror on a closure corresponding to that method.
372 * 375 *
373 * If this mirror is a [ClassMirror], and [fieldName] denotes a static method 376 * If this mirror is a [ClassMirror], and [fieldName] denotes a static method
374 * in the corresponding class, the result of the invocation is an instance 377 * in the corresponding class, the result of the invocation is an instance
375 * mirror on a closure corresponding to that method. 378 * mirror on a closure corresponding to that method.
376 * 379 *
377 * If the invocation returns a result *r*, this method returns 380 * If the invocation returns a result *r*, this method returns
378 * the result of calling [reflect](*r*). 381 * the result of calling [reflect](*r*).
379 * If the invocation causes a compilation error 382 * If the invocation causes a compilation error
380 * the effect is the same as if a non-reflective compilation error 383 * the effect is the same as if a non-reflective compilation error
381 * had been encountered. 384 * had been encountered.
382 * If the invocation throws an exception *e* (that it does not catch) 385 * If the invocation throws an exception *e* (that it does not catch)
383 * this method throws *e*. 386 * this method throws *e*.
384 */ 387 */
385 /* TODO(turnidge): Handle ambiguous names.*/ 388 // TODO(ahe): Remove stuff about scope and private members. [fieldName] is a
389 // capability giving access to private members.
386 InstanceMirror getField(Symbol fieldName); 390 InstanceMirror getField(Symbol fieldName);
387 391
388 /** 392 /**
389 * Invokes a setter and returns a mirror on the result. The setter 393 * Invokes a setter and returns a mirror on the result. The setter
390 * may be either the implicit setter for a non-final field or a 394 * may be either the implicit setter for a non-final field or a
391 * user-defined setter method. 395 * user-defined setter method.
392 * 396 *
393 * Let *o* be the object reflected by this mirror, let 397 * Let *o* be the object reflected by this mirror, let
394 * *f* be the simple name of the getter denoted by [fieldName], 398 * *f* be the simple name of the getter denoted by [fieldName],
395 * and let *a* be the object bound to [value]. 399 * and let *a* be the object bound to [value].
396 * Then this method will perform the setter invocation 400 * Then this method will perform the setter invocation
397 * *o.f = a* 401 * *o.f = a*
398 * in a scope that has access to the private members 402 * in a scope that has access to the private members
399 * of *o* (if *o* is a class or library) or the private members of the 403 * of *o* (if *o* is a class or library) or the private members of the
400 * class of *o* (otherwise). 404 * class of *o* (otherwise).
401 * If the invocation returns a result *r*, this method returns 405 * If the invocation returns a result *r*, this method returns
402 * the result of calling [reflect]([value]). 406 * the result of calling [reflect]([value]).
403 * If the invocation causes a compilation error 407 * If the invocation causes a compilation error
404 * the effect is the same as if a non-reflective compilation error 408 * the effect is the same as if a non-reflective compilation error
405 * had been encountered. 409 * had been encountered.
406 * If the invocation throws an exception *e* (that it does not catch) 410 * If the invocation throws an exception *e* (that it does not catch)
407 * this method throws *e*. 411 * this method throws *e*.
408 */ 412 */
409 /* TODO(turnidge): Handle ambiguous names.*/ 413 /* TODO(turnidge): Handle ambiguous names.*/
410 InstanceMirror setField(Symbol fieldName, Object value); 414 InstanceMirror setField(Symbol fieldName, Object value);
411 } 415 }
412 416
413 /** 417 /**
414 * An [InstanceMirror] reflects an instance of a Dart language object. 418 * An [InstanceMirror] reflects an instance of a Dart language object.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 479
476 /** 480 /**
477 * A [ClosureMirror] reflects a closure. 481 * A [ClosureMirror] reflects a closure.
478 * 482 *
479 * A [ClosureMirror] provides access to its captured variables and 483 * A [ClosureMirror] provides access to its captured variables and
480 * provides the ability to execute its reflectee. 484 * provides the ability to execute its reflectee.
481 */ 485 */
482 abstract class ClosureMirror implements InstanceMirror { 486 abstract class ClosureMirror implements InstanceMirror {
483 /** 487 /**
484 * A mirror on the function associated with this closure. 488 * A mirror on the function associated with this closure.
489 *
490 * The function associated with an implicit closure of a function is that
491 * function.
492 *
493 * The function associated with an instance of a class that has a [:call:]
494 * method is that [:call:] method.
485 */ 495 */
486 MethodMirror get function; 496 MethodMirror get function;
487 497
488 /** 498 /**
489 * Executes the closure and returns a mirror on the result. 499 * Executes the closure and returns a mirror on the result.
490 * Let *f* be the closure reflected by this mirror, 500 * Let *f* be the closure reflected by this mirror,
491 * let *a1, ..., an* be the elements of [positionalArguments] 501 * let *a1, ..., an* be the elements of [positionalArguments]
492 * let *k1, ..., km* be the identifiers denoted by the elements of 502 * let *k1, ..., km* be the identifiers denoted by the elements of
493 * [namedArguments.keys] 503 * [namedArguments.keys]
494 * and let *v1, ..., vm* be the elements of [namedArguments.values]. 504 * and let *v1, ..., vm* be the elements of [namedArguments.values].
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 * library. 539 * library.
530 */ 540 */
531 abstract class LibraryMirror implements DeclarationMirror, ObjectMirror { 541 abstract class LibraryMirror implements DeclarationMirror, ObjectMirror {
532 /** 542 /**
533 * The absolute uri of the library. 543 * The absolute uri of the library.
534 */ 544 */
535 Uri get uri; 545 Uri get uri;
536 546
537 /** 547 /**
538 * Returns an immutable map of the declarations actually given in the library. 548 * Returns an immutable map of the declarations actually given in the library.
539 * 549 *
540 * This map includes all regular methods, getters, setters, fields, classes 550 * This map includes all regular methods, getters, setters, fields, classes
541 * and typedefs actually declared in the library. The map is keyed by the 551 * and typedefs actually declared in the library. The map is keyed by the
542 * simple names of the declarations. 552 * simple names of the declarations.
543 */ 553 */
544 Map<Symbol, DeclarationMirror> get declarations; 554 Map<Symbol, DeclarationMirror> get declarations;
545 555
546 /** 556 /**
547 * An immutable map from from names to mirrors for all members in
548 * this library.
549 *
550 * The members of a library are its top-level classes,
551 * functions, variables, getters, and setters.
552 */
553 Map<Symbol, Mirror> get members;
554
555 /**
556 * An immutable map from names to mirrors for all class
557 * declarations in this library.
558 */
559 Map<Symbol, ClassMirror> get classes;
560
561 /**
562 * An immutable map from names to mirrors for all type
563 * declarations in this library.
564 */
565 Map<Symbol, TypeMirror> get types;
566
567 /**
568 * An immutable map from names to mirrors for all function, getter,
569 * and setter declarations in this library.
570 */
571 Map<Symbol, MethodMirror> get functions;
572
573 /**
574 * An immutable map from names to mirrors for all getter
575 * declarations in this library.
576 */
577 Map<Symbol, MethodMirror> get getters;
578
579 /**
580 * An immutable map from names to mirrors for all setter
581 * declarations in this library.
582 */
583 Map<Symbol, MethodMirror> get setters;
584
585 /**
586 * An immutable map from names to mirrors for all variable
587 * declarations in this library.
588 */
589 Map<Symbol, VariableMirror> get variables;
590
591 /**
592 * Returns [:true:] if this mirror is equal to [other]. 557 * Returns [:true:] if this mirror is equal to [other].
593 * Otherwise returns [:false:]. 558 * Otherwise returns [:false:].
594 * 559 *
595 * The equality holds if and only if 560 * The equality holds if and only if
596 * (1) [other] is a mirror of the same kind 561 * (1) [other] is a mirror of the same kind
597 * and 562 * and
598 * (2) The library being reflected by this mirror 563 * (2) The library being reflected by this mirror
599 * and the library being reflected by [other] 564 * and the library being reflected by [other]
600 * are 565 * are
601 * the same library in the same isolate. 566 * the same library in the same isolate.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 * 644 *
680 * If this type is [:Object:], the superclass will be null. 645 * If this type is [:Object:], the superclass will be null.
681 */ 646 */
682 ClassMirror get superclass; 647 ClassMirror get superclass;
683 648
684 /** 649 /**
685 * A list of mirrors on the superinterfaces of the reflectee. 650 * A list of mirrors on the superinterfaces of the reflectee.
686 */ 651 */
687 List<ClassMirror> get superinterfaces; 652 List<ClassMirror> get superinterfaces;
688 653
689 /** 654 /**
690 * Returns an immutable map of the declarations actually given in the class 655 * Returns an immutable map of the declarations actually given in the class
691 * declaration. 656 * declaration.
692 * 657 *
693 * This map includes all regular methods, getters, setters, fields, 658 * This map includes all regular methods, getters, setters, fields,
694 * constructors and type variables actually declared in the class. Both 659 * constructors and type variables actually declared in the class. Both
695 * static and instance members are included, but no inherited members are 660 * static and instance members are included, but no inherited members are
696 * included. The map is keyed by the simple names of the declarations. 661 * included. The map is keyed by the simple names of the declarations.
662 *
663 * This does not include inherited members.
697 */ 664 */
698 Map<Symbol, DeclarationMirror> get declarations; 665 Map<Symbol, DeclarationMirror> get declarations;
699 666
700 /** 667 /**
701 * The mixin of this class. 668 * The mixin of this class.
702 * If this class is the result of a mixin application of the 669 * If this class is the result of a mixin application of the
703 * form S with M, returns a class mirror on M. 670 * form S with M, returns a class mirror on M.
704 * Otherwise returns a class mirror on [reflectee]. 671 * Otherwise returns a class mirror on [reflectee].
705 */ 672 */
706 ClassMirror get mixin; 673 ClassMirror get mixin;
707 674
708 /** 675 // TODO(ahe): What about:
709 * An immutable map from names to mirrors for all members of 676 // /// Finds the instance member named [name] declared or inherited in the
710 * this type. 677 // /// reflected class.
711 * 678 // DeclarationMirror instanceLookup(Symbol name);
712 * The members of a type are its methods, fields, getters, and
713 * setters. Note that constructors and type variables are not
714 * considered to be members of a type.
715 *
716 * This does not include inherited members.
717 */
718 Map<Symbol, Mirror> get members;
719
720 /**
721 * An immutable map from names to mirrors for all method,
722 * declarations for this type. This does not include getters and
723 * setters.
724 */
725 Map<Symbol, MethodMirror> get methods;
726
727 /**
728 * An immutable map from names to mirrors for all getter
729 * declarations for this type.
730 */
731 Map<Symbol, MethodMirror> get getters;
732
733 /**
734 * An immutable map from names to mirrors for all setter
735 * declarations for this type.
736 */
737 Map<Symbol, MethodMirror> get setters;
738
739 /**
740 * An immutable map from names to mirrors for all variable
741 * declarations for this type.
742 */
743 Map<Symbol, VariableMirror> get variables;
744
745 /**
746 * An immutable map from names to mirrors for all constructor
747 * declarations for this type.
748 */
749 Map<Symbol, MethodMirror> get constructors;
750 679
751 /** 680 /**
752 * Invokes the named constructor and returns a mirror on the result. 681 * Invokes the named constructor and returns a mirror on the result.
753 * 682 *
754 * Let *c* be the class reflected by this mirror 683 * Let *c* be the class reflected by this mirror
755 * let *a1, ..., an* be the elements of [positionalArguments] 684 * let *a1, ..., an* be the elements of [positionalArguments]
756 * let *k1, ..., km* be the identifiers denoted by the elements of 685 * let *k1, ..., km* be the identifiers denoted by the elements of
757 * [namedArguments.keys] 686 * [namedArguments.keys]
758 * and let *v1, ..., vm* be the elements of [namedArguments.values]. 687 * and let *v1, ..., vm* be the elements of [namedArguments.values].
759 * If [constructorName] was created from the empty string 688 * If [constructorName] was created from the empty string
760 * Then this method will execute the instance creation expression 689 * Then this method will execute the instance creation expression
761 * *new c(a1, ..., an, k1: v1, ..., km: vm)* 690 * *new c(a1, ..., an, k1: v1, ..., km: vm)*
762 * in a scope that has access to the private members 691 * in a scope that has access to the private members
763 * of *c*. Otherwise, let 692 * of *c*. Otherwise, let
764 * *f* be the simple name of the constructor denoted by [constructorName] 693 * *f* be the simple name of the constructor denoted by [constructorName]
765 * Then this method will execute the instance creation expression 694 * Then this method will execute the instance creation expression
766 * *new c.f(a1, ..., an, k1: v1, ..., km: vm)* 695 * *new c.f(a1, ..., an, k1: v1, ..., km: vm)*
767 * in a scope that has access to the private members 696 * in a scope that has access to the private members
768 * of *c*. 697 * of *c*.
769 * In either case: 698 * In either case:
770 * If the expression evaluates to a result *r*, this method returns 699 * If the expression evaluates to a result *r*, this method returns
771 * the result of calling [reflect](*r*). 700 * the result of calling [reflect](*r*).
772 * If evaluating the expression causes a compilation error 701 * If evaluating the expression causes a compilation error
773 * the effect is the same as if a non-reflective compilation error 702 * the effect is the same as if a non-reflective compilation error
774 * had been encountered. 703 * had been encountered.
775 * If evaluating the expression throws an exception *e* 704 * If evaluating the expression throws an exception *e*
776 * (that it does not catch) 705 * (that it does not catch)
777 * this method throws *e*. 706 * this method throws *e*.
778 */ 707 */
779 InstanceMirror newInstance(Symbol constructorName, 708 InstanceMirror newInstance(Symbol constructorName,
780 List positionalArguments, 709 List positionalArguments,
781 [Map<Symbol,dynamic> namedArguments]); 710 [Map<Symbol,dynamic> namedArguments]);
782 711
783 /** 712 /**
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 InstanceMirror get defaultValue; 964 InstanceMirror get defaultValue;
1036 } 965 }
1037 966
1038 /** 967 /**
1039 * A [SourceLocation] describes the span of an entity in Dart source code. 968 * A [SourceLocation] describes the span of an entity in Dart source code.
1040 */ 969 */
1041 abstract class SourceLocation { 970 abstract class SourceLocation {
1042 } 971 }
1043 972
1044 /** 973 /**
1045 * When an error occurs during the mirrored execution of code, a
1046 * [MirroredError] is thrown.
1047 *
1048 * In general, there are three main classes of failure that can happen
1049 * during mirrored execution of code in some isolate:
1050 *
1051 * - An exception is thrown but not caught. This is caught by the
1052 * mirrors framework and a [MirroredUncaughtExceptionError] is
1053 * created and thrown.
1054 *
1055 * - A compile-time error occurs, such as a syntax error. This is
1056 * suppressed by the mirrors framework and a
1057 * [MirroredCompilationError] is created and thrown.
1058 *
1059 * - A truly fatal error occurs, causing the isolate to be exited. If
1060 * the reflector and reflectee share the same isolate, then they
1061 * will both suffer. If the reflector and reflectee are in distinct
1062 * isolates, then we hope to provide some information about the
1063 * isolate death, but this has yet to be implemented.
1064 *
1065 * TODO(turnidge): Specify the behavior for remote fatal errors.
1066 */
1067 abstract class MirroredError implements Exception {
1068 }
1069
1070 /**
1071 * When an uncaught exception occurs during the mirrored execution
1072 * of code, a [MirroredUncaughtExceptionError] is thrown.
1073 *
1074 * This exception contains a mirror on the original exception object.
1075 * It also contains an object which can be used to recover the
1076 * stacktrace.
1077 */
1078 class MirroredUncaughtExceptionError extends MirroredError {
1079 MirroredUncaughtExceptionError(this.exception_mirror,
1080 this.exception_string,
1081 this.stacktrace) {}
1082
1083 /** A mirror on the exception object. */
1084 final InstanceMirror exception_mirror;
1085
1086 /** The result of toString() for the exception object. */
1087 final String exception_string;
1088
1089 /** A stacktrace object for the uncaught exception. */
1090 final Object stacktrace;
1091
1092 String toString() {
1093 return
1094 "Uncaught exception during mirrored execution: <${exception_string}>";
1095 }
1096 }
1097
1098 /**
1099 * When a compile-time error occurs during the mirrored execution
1100 * of code, a [MirroredCompilationError] is thrown.
1101 *
1102 * This exception includes the compile-time error message that would
1103 * have been displayed to the user, if the function had not been
1104 * invoked via mirror.
1105 */
1106 class MirroredCompilationError extends MirroredError {
1107 MirroredCompilationError(this.message) {}
1108
1109 final String message;
1110
1111 String toString() {
1112 return "Compile-time error during mirrored execution: <$message>";
1113 }
1114 }
1115
1116 /**
1117 * A [MirrorException] is used to indicate errors within the mirrors
1118 * framework.
1119 */
1120 class MirrorException implements Exception {
1121 const MirrorException(String this._message);
1122 String toString() => "MirrorException: '$_message'";
1123 final String _message;
1124 }
1125
1126 /**
1127 * Class used for encoding comments as metadata annotations. 974 * Class used for encoding comments as metadata annotations.
1128 */ 975 */
1129 class Comment { 976 class Comment {
1130 /** 977 /**
1131 * The comment text as written in the source text. 978 * The comment text as written in the source text.
1132 */ 979 */
1133 final String text; 980 final String text;
1134 981
1135 /** 982 /**
1136 * The comment text without the start, end, and padding text. 983 * The comment text without the start, end, and padding text.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 * 1089 *
1243 * When used as metadata on an import of "dart:mirrors", this metadata does 1090 * When used as metadata on an import of "dart:mirrors", this metadata does
1244 * not apply to the library in which the annotation is used, but instead 1091 * not apply to the library in which the annotation is used, but instead
1245 * applies to the other libraries (all libraries if "*" is used). 1092 * applies to the other libraries (all libraries if "*" is used).
1246 */ 1093 */
1247 final override; 1094 final override;
1248 1095
1249 const MirrorsUsed( 1096 const MirrorsUsed(
1250 {this.symbols, this.targets, this.metaTargets, this.override}); 1097 {this.symbols, this.targets, this.metaTargets, this.override});
1251 } 1098 }
OLDNEW
« no previous file with comments | « dart/sdk/lib/_internal/pub/lib/src/utils.dart ('k') | dart/tests/co19/co19-analyzer.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698