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

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

Issue 23490019: API changes to make TypedefMirror a direct descendant of TypeMirror. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | « no previous file | no next file » | 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 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 */ 636 */
624 Map<Symbol, Mirror> get members; 637 Map<Symbol, Mirror> get members;
625 638
626 /** 639 /**
627 * An immutable map from names to mirrors for all class 640 * An immutable map from names to mirrors for all class
628 * declarations in this library. 641 * declarations in this library.
629 */ 642 */
630 Map<Symbol, ClassMirror> get classes; 643 Map<Symbol, ClassMirror> get classes;
631 644
632 /** 645 /**
646 * An immutable map from names to mirrors for all type
647 * declarations in this library.
648 */
649 Map<Symbol, TypeMirror> get types;
ahe 2013/09/05 20:48:26 I assume this goes away again after the "mirrors o
rmacnak 2013/09/05 22:43:29 Right, this would be covered by LibraryMirror.decl
650
651 /**
633 * An immutable map from names to mirrors for all function, getter, 652 * An immutable map from names to mirrors for all function, getter,
634 * and setter declarations in this library. 653 * and setter declarations in this library.
635 */ 654 */
636 Map<Symbol, MethodMirror> get functions; 655 Map<Symbol, MethodMirror> get functions;
637 656
638 /** 657 /**
639 * An immutable map from names to mirrors for all getter 658 * An immutable map from names to mirrors for all getter
640 * declarations in this library. 659 * declarations in this library.
641 */ 660 */
642 Map<Symbol, MethodMirror> get getters; 661 Map<Symbol, MethodMirror> get getters;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 706
688 /** 707 /**
689 * If [:hasReflectedType:] returns true, returns the corresponding [Type]. 708 * If [:hasReflectedType:] returns true, returns the corresponding [Type].
690 * Otherwise, an [UnsupportedError] is thrown. 709 * Otherwise, an [UnsupportedError] is thrown.
691 */ 710 */
692 Type get reflectedType; 711 Type get reflectedType;
693 712
694 /** 713 /**
695 * A mirror on the superclass on the reflectee. 714 * A mirror on the superclass on the reflectee.
696 * 715 *
697 * If this type is [:Object:] or a typedef, the superClass will be 716 * If this type is [:Object:], the superClass will be null.
698 * null.
699 */ 717 */
700 ClassMirror get superclass; 718 ClassMirror get superclass;
701 719
702 /** 720 /**
703 * A list of mirrors on the superinterfaces of the reflectee. 721 * A list of mirrors on the superinterfaces of the reflectee.
704 */ 722 */
705 List<ClassMirror> get superinterfaces; 723 List<ClassMirror> get superinterfaces;
706 724
707 /** 725 /**
708 * An immutable map from from names to mirrors for all members of 726 * An immutable map from from names to mirrors for all members of
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 * a generic class,(2) implies that the reflected class 898 * a generic class,(2) implies that the reflected class
881 * and [other] have equal type arguments. 899 * and [other] have equal type arguments.
882 */ 900 */
883 bool operator == (other); 901 bool operator == (other);
884 } 902 }
885 903
886 /** 904 /**
887 * A [FunctionTypeMirror] represents the type of a function in the 905 * A [FunctionTypeMirror] represents the type of a function in the
888 * Dart language. 906 * Dart language.
889 */ 907 */
890 abstract class FunctionTypeMirror implements ClassMirror { 908 abstract class FunctionTypeMirror implements ClassMirror {
ahe 2013/09/05 20:48:26 This is still a bit weird I think.
891 /** 909 /**
892 * Returns the return type of the reflectee. 910 * Returns the return type of the reflectee.
893 */ 911 */
894 TypeMirror get returnType; 912 TypeMirror get returnType;
895 913
896 /** 914 /**
897 * Returns a list of the parameter types of the reflectee. 915 * Returns a list of the parameter types of the reflectee.
898 */ 916 */
899 List<ParameterMirror> get parameters; 917 List<ParameterMirror> get parameters;
900 918
901 /** 919 /**
902 * A mirror on the [:call:] method for the reflectee. 920 * A mirror on the [:call:] method for the reflectee.
903 */ 921 */
904 MethodMirror get callMethod; 922 MethodMirror get callMethod;
ahe 2013/09/05 20:48:26 This method makes little sense to me. Do you know
rmacnak 2013/09/05 22:43:29 The methods of closures are special. reflect(()=>n
905 } 923 }
906 924
907 /** 925 /**
908 * A [TypeVariableMirror] represents a type parameter of a generic 926 * A [TypeVariableMirror] represents a type parameter of a generic
909 * type. 927 * type.
910 */ 928 */
911 abstract class TypeVariableMirror extends TypeMirror { 929 abstract class TypeVariableMirror extends TypeMirror {
912 /** 930 /**
913 * A mirror on the type that is the upper bound of this type variable. 931 * A mirror on the type that is the upper bound of this type variable.
914 */ 932 */
915 TypeMirror get upperBound; 933 TypeMirror get upperBound;
916 934
917 /** 935 /**
918 * Returns [:true:] if this mirror is equal to [other]. 936 * Returns [:true:] if this mirror is equal to [other].
919 * Otherwise returns [:false:]. 937 * Otherwise returns [:false:].
920 * 938 *
921 * The equality holds if and only if 939 * The equality holds if and only if
922 * (1) [other] is a mirror of the same kind 940 * (1) [other] is a mirror of the same kind
923 * and 941 * and
924 * (2) [:simpleName == other.simpleName:] and 942 * (2) [:simpleName == other.simpleName:] and
925 * [:owner == other.owner:]. 943 * [:owner == other.owner:].
926 */ 944 */
927 bool operator == (other); 945 bool operator == (other);
928 } 946 }
929 947
930 /** 948 /**
931 * A [TypedefMirror] represents a typedef in a Dart language program. 949 * A [TypedefMirror] represents a typedef in a Dart language program.
932 */ 950 */
933 abstract class TypedefMirror implements ClassMirror { 951 abstract class TypedefMirror implements TypeMirror {
934 /** 952 /**
935 * The defining type for this typedef. 953 * The defining type for this typedef.
936 * 954 *
937 * For instance [:void f(int):] is the value for [:typedef void f(int):]. 955 * For instance [:void f(int):] is the referent for [:typedef void f(int):].
938 */ 956 */
939 TypeMirror get value; 957 TypeMirror get referent;
940 } 958 }
941 959
942 /** 960 /**
943 * A [MethodMirror] reflects a Dart language function, method, 961 * A [MethodMirror] reflects a Dart language function, method,
944 * constructor, getter, or setter. 962 * constructor, getter, or setter.
945 */ 963 */
946 abstract class MethodMirror implements DeclarationMirror { 964 abstract class MethodMirror implements DeclarationMirror {
947 /** 965 /**
948 * A mirror on the return type for the reflectee. 966 * A mirror on the return type for the reflectee.
949 */ 967 */
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 * 1341 *
1324 * When used as metadata on an import of "dart:mirrors", this metadata does 1342 * When used as metadata on an import of "dart:mirrors", this metadata does
1325 * not apply to the library in which the annotation is used, but instead 1343 * not apply to the library in which the annotation is used, but instead
1326 * applies to the other libraries (all libraries if "*" is used). 1344 * applies to the other libraries (all libraries if "*" is used).
1327 */ 1345 */
1328 final override; 1346 final override;
1329 1347
1330 const MirrorsUsed( 1348 const MirrorsUsed(
1331 {this.symbols, this.targets, this.metaTargets, this.override}); 1349 {this.symbols, this.targets, this.metaTargets, this.override});
1332 } 1350 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698