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

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

Issue 24005002: Make TypedefMirror a direct descendant of TypeMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 years, 2 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
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 * obtain mirrors on objects of the current isolate. 128 * obtain mirrors on objects of the current isolate.
129 */ 129 */
130 external InstanceMirror reflect(Object reflectee); 130 external InstanceMirror reflect(Object reflectee);
131 131
132 /** 132 /**
133 * Let *C* be the original class declaration of the class 133 * Let *C* be the original class declaration of the class
134 * represented by [key]. 134 * represented by [key].
135 * This function returns a [ClassMirror] reflecting *C*. 135 * This function returns a [ClassMirror] reflecting *C*.
136 * 136 *
137 * If [key] is not an instance of [Type] then this function 137 * If [key] is not an instance of [Type] then this function
138 * throws an [ArgumentError]. If [key] is the Type dynamic, 138 * throws an [ArgumentError]. If [key] is the Type for dynamic
139 * throws an [ArgumentError] because dynamic is not a class. 139 * or a function typedef, throws an [ArgumentError].
140 * 140 *
141 * Note that since one cannot obtain a [Type] object from 141 * Note that since one cannot obtain a [Type] object from
142 * another isolate, this function can only be used to 142 * another isolate, this function can only be used to
143 * obtain class mirrors on classes of the current isolate. 143 * obtain class mirrors on classes of the current isolate.
144 */ 144 */
145 external ClassMirror reflectClass(Type key); 145 external ClassMirror reflectClass(Type key);
146 146
147 /** 147 /**
148 * This function returns a [TypeMirror] reflecting the type
149 * represented by [key].
150 *
151 * If [key] is not an instance of [Type] then this function
152 * throws an [ArgumentError].
153 *
154 * Note that since one cannot obtain a [Type] object from
155 * another isolate, this function can only be used to
156 * obtain type mirrors on types of the current isolate.
157 */
158 external TypeMirror reflectType(Type key);
159
160 /**
148 * A [Mirror] reflects some Dart language entity. 161 * A [Mirror] reflects some Dart language entity.
149 * 162 *
150 * Every [Mirror] originates from some [MirrorSystem]. 163 * Every [Mirror] originates from some [MirrorSystem].
151 */ 164 */
152 abstract class Mirror { 165 abstract class Mirror {
153 /** 166 /**
154 * The [MirrorSystem] that contains this mirror. 167 * The [MirrorSystem] that contains this mirror.
155 */ 168 */
156 MirrorSystem get mirrors; 169 MirrorSystem get mirrors;
157 } 170 }
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 * in the corresponding class, the result of the invocation is an instance 460 * in the corresponding class, the result of the invocation is an instance
448 * mirror on a closure corresponding to that method. 461 * mirror on a closure corresponding to that method.
449 * 462 *
450 * The method returns a future *k*. 463 * The method returns a future *k*.
451 * If the invocation returns a result *r*, *k* will be completed 464 * If the invocation returns a result *r*, *k* will be completed
452 * with the result of calling [reflect](*r*). 465 * with the result of calling [reflect](*r*).
453 * If the invocation throws an exception *e* (that it does not catch) 466 * If the invocation throws an exception *e* (that it does not catch)
454 * then *k* is completed with a [MirrorError] wrapping *e*. 467 * then *k* is completed with a [MirrorError] wrapping *e*.
455 */ 468 */
456 /* TODO(turnidge): Handle ambiguous names.*/ 469 /* TODO(turnidge): Handle ambiguous names.*/
457 Future<InstanceMirror> getFieldAsync(Symbol fieldName); 470 Future<InstanceMirror> getFieldAsync(Symbol fieldName);
gbracha 2013/10/02 22:49:53 Didn't we get rid of getFieldAsync?
rmacnak 2013/10/03 17:24:47 In another CL awaiting review.
458 471
459 /** 472 /**
460 * Invokes a setter and returns a mirror on the result. The setter 473 * Invokes a setter and returns a mirror on the result. The setter
461 * may be either the implicit setter for a non-final field or a 474 * may be either the implicit setter for a non-final field or a
462 * user-defined setter method. 475 * user-defined setter method.
463 * The second argument must be an instance of [InstanceMirror], or of 476 * The second argument must be an instance of [InstanceMirror], or of
464 * a type that is serializable across isolates (currently [num], 477 * a type that is serializable across isolates (currently [num],
465 * [String], or [bool]). 478 * [String], or [bool]).
466 * 479 *
467 * Let *o* be the object reflected by this mirror, let 480 * Let *o* be the object reflected by this mirror, let
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 */ 662 */
650 Map<Symbol, Mirror> get members; 663 Map<Symbol, Mirror> get members;
651 664
652 /** 665 /**
653 * An immutable map from names to mirrors for all class 666 * An immutable map from names to mirrors for all class
654 * declarations in this library. 667 * declarations in this library.
655 */ 668 */
656 Map<Symbol, ClassMirror> get classes; 669 Map<Symbol, ClassMirror> get classes;
657 670
658 /** 671 /**
672 * An immutable map from names to mirrors for all type
673 * declarations in this library.
674 */
675 Map<Symbol, TypeMirror> get types;
676
677 /**
659 * An immutable map from names to mirrors for all function, getter, 678 * An immutable map from names to mirrors for all function, getter,
660 * and setter declarations in this library. 679 * and setter declarations in this library.
661 */ 680 */
662 Map<Symbol, MethodMirror> get functions; 681 Map<Symbol, MethodMirror> get functions;
663 682
664 /** 683 /**
665 * An immutable map from names to mirrors for all getter 684 * An immutable map from names to mirrors for all getter
666 * declarations in this library. 685 * declarations in this library.
667 */ 686 */
668 Map<Symbol, MethodMirror> get getters; 687 Map<Symbol, MethodMirror> get getters;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 732
714 /** 733 /**
715 * If [:hasReflectedType:] returns true, returns the corresponding [Type]. 734 * If [:hasReflectedType:] returns true, returns the corresponding [Type].
716 * Otherwise, an [UnsupportedError] is thrown. 735 * Otherwise, an [UnsupportedError] is thrown.
717 */ 736 */
718 Type get reflectedType; 737 Type get reflectedType;
719 738
720 /** 739 /**
721 * A mirror on the superclass on the reflectee. 740 * A mirror on the superclass on the reflectee.
722 * 741 *
723 * If this type is [:Object:] or a typedef, the superClass will be 742 * If this type is [:Object:], the superclass will be null.
724 * null.
725 */ 743 */
726 ClassMirror get superclass; 744 ClassMirror get superclass;
727 745
728 /** 746 /**
729 * A list of mirrors on the superinterfaces of the reflectee. 747 * A list of mirrors on the superinterfaces of the reflectee.
730 */ 748 */
731 List<ClassMirror> get superinterfaces; 749 List<ClassMirror> get superinterfaces;
732 750
733 /** 751 /**
734 * An immutable map from from names to mirrors for all members of 752 * An immutable map from from names to mirrors for all members of
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 * and 965 * and
948 * (2) [:simpleName == other.simpleName:] and 966 * (2) [:simpleName == other.simpleName:] and
949 * [:owner == other.owner:]. 967 * [:owner == other.owner:].
950 */ 968 */
951 bool operator == (other); 969 bool operator == (other);
952 } 970 }
953 971
954 /** 972 /**
955 * A [TypedefMirror] represents a typedef in a Dart language program. 973 * A [TypedefMirror] represents a typedef in a Dart language program.
956 */ 974 */
957 abstract class TypedefMirror implements ClassMirror { 975 abstract class TypedefMirror implements TypeMirror {
958 /** 976 /**
959 * The defining type for this typedef. 977 * The defining type for this typedef.
960 * 978 *
961 * For instance [:void f(int):] is the value for [:typedef void f(int):]. 979 * For instance [:void f(int):] is the referent for [:typedef void f(int):].
962 */ 980 */
963 TypeMirror get value; 981 TypeMirror get referent;
964 } 982 }
965 983
966 /** 984 /**
967 * A [MethodMirror] reflects a Dart language function, method, 985 * A [MethodMirror] reflects a Dart language function, method,
968 * constructor, getter, or setter. 986 * constructor, getter, or setter.
969 */ 987 */
970 abstract class MethodMirror implements DeclarationMirror { 988 abstract class MethodMirror implements DeclarationMirror {
971 /** 989 /**
972 * A mirror on the return type for the reflectee. 990 * A mirror on the return type for the reflectee.
973 */ 991 */
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 * 1365 *
1348 * When used as metadata on an import of "dart:mirrors", this metadata does 1366 * When used as metadata on an import of "dart:mirrors", this metadata does
1349 * not apply to the library in which the annotation is used, but instead 1367 * not apply to the library in which the annotation is used, but instead
1350 * applies to the other libraries (all libraries if "*" is used). 1368 * applies to the other libraries (all libraries if "*" is used).
1351 */ 1369 */
1352 final override; 1370 final override;
1353 1371
1354 const MirrorsUsed( 1372 const MirrorsUsed(
1355 {this.symbols, this.targets, this.metaTargets, this.override}); 1373 {this.symbols, this.targets, this.metaTargets, this.override});
1356 } 1374 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698