| OLD | NEW |
| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 */ | 143 */ |
| 144 external InstanceMirror reflect(Object reflectee); | 144 external InstanceMirror reflect(Object reflectee); |
| 145 | 145 |
| 146 /** | 146 /** |
| 147 * Reflects a class declaration. | 147 * Reflects a class declaration. |
| 148 * Let *C* be the original class declaration of the class | 148 * Let *C* be the original class declaration of the class |
| 149 * represented by [key]. | 149 * represented by [key]. |
| 150 * This function returns a [ClassMirror] reflecting *C*. | 150 * This function returns a [ClassMirror] reflecting *C*. |
| 151 * | 151 * |
| 152 * If [key] is not an instance of [Type] then this function | 152 * If [key] is not an instance of [Type] then this function |
| 153 * throws an [ArgumentError]. If [key] is the Type [:dynamic:], | 153 * throws an [ArgumentError]. If [key] is the Type for dynamic |
| 154 * throws an [ArgumentError] because dynamic is not a class. | 154 * or a function typedef, throws an [ArgumentError]. |
| 155 * | 155 * |
| 156 * Note that since one cannot obtain a [Type] object from | 156 * Note that since one cannot obtain a [Type] object from |
| 157 * another isolate, this function can only be used to | 157 * another isolate, this function can only be used to |
| 158 * obtain class mirrors on classes of the current isolate. | 158 * obtain class mirrors on classes of the current isolate. |
| 159 */ | 159 */ |
| 160 external ClassMirror reflectClass(Type key); | 160 external ClassMirror reflectClass(Type key); |
| 161 | 161 |
| 162 /** | 162 /** |
| 163 * This function returns a [TypeMirror] reflecting the type |
| 164 * represented by [key]. |
| 165 * |
| 166 * If [key] is not an instance of [Type] then this function |
| 167 * throws an [ArgumentError]. |
| 168 * |
| 169 * Note that since one cannot obtain a [Type] object from |
| 170 * another isolate, this function can only be used to |
| 171 * obtain type mirrors on types of the current isolate. |
| 172 */ |
| 173 external TypeMirror reflectType(Type key); |
| 174 |
| 175 /** |
| 163 * A [Mirror] reflects some Dart language entity. | 176 * A [Mirror] reflects some Dart language entity. |
| 164 * | 177 * |
| 165 * Every [Mirror] originates from some [MirrorSystem]. | 178 * Every [Mirror] originates from some [MirrorSystem]. |
| 166 */ | 179 */ |
| 167 abstract class Mirror { | 180 abstract class Mirror { |
| 168 /** | 181 /** |
| 169 * The [MirrorSystem] that contains this mirror. | 182 * The [MirrorSystem] that contains this mirror. |
| 170 */ | 183 */ |
| 171 MirrorSystem get mirrors; | 184 MirrorSystem get mirrors; |
| 172 } | 185 } |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 */ | 684 */ |
| 672 Map<Symbol, Mirror> get members; | 685 Map<Symbol, Mirror> get members; |
| 673 | 686 |
| 674 /** | 687 /** |
| 675 * An immutable map from names to mirrors for all class | 688 * An immutable map from names to mirrors for all class |
| 676 * declarations in this library. | 689 * declarations in this library. |
| 677 */ | 690 */ |
| 678 Map<Symbol, ClassMirror> get classes; | 691 Map<Symbol, ClassMirror> get classes; |
| 679 | 692 |
| 680 /** | 693 /** |
| 694 * An immutable map from names to mirrors for all type |
| 695 * declarations in this library. |
| 696 */ |
| 697 Map<Symbol, TypeMirror> get types; |
| 698 |
| 699 /** |
| 681 * An immutable map from names to mirrors for all function, getter, | 700 * An immutable map from names to mirrors for all function, getter, |
| 682 * and setter declarations in this library. | 701 * and setter declarations in this library. |
| 683 */ | 702 */ |
| 684 Map<Symbol, MethodMirror> get functions; | 703 Map<Symbol, MethodMirror> get functions; |
| 685 | 704 |
| 686 /** | 705 /** |
| 687 * An immutable map from names to mirrors for all getter | 706 * An immutable map from names to mirrors for all getter |
| 688 * declarations in this library. | 707 * declarations in this library. |
| 689 */ | 708 */ |
| 690 Map<Symbol, MethodMirror> get getters; | 709 Map<Symbol, MethodMirror> get getters; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 | 765 |
| 747 /** | 766 /** |
| 748 * If [:hasReflectedType:] returns true, returns the corresponding [Type]. | 767 * If [:hasReflectedType:] returns true, returns the corresponding [Type]. |
| 749 * Otherwise, an [UnsupportedError] is thrown. | 768 * Otherwise, an [UnsupportedError] is thrown. |
| 750 */ | 769 */ |
| 751 Type get reflectedType; | 770 Type get reflectedType; |
| 752 | 771 |
| 753 /** | 772 /** |
| 754 * A mirror on the superclass on the reflectee. | 773 * A mirror on the superclass on the reflectee. |
| 755 * | 774 * |
| 756 * If this type is [:Object:] or a typedef, the superClass will be | 775 * If this type is [:Object:], the superclass will be null. |
| 757 * null. | |
| 758 */ | 776 */ |
| 759 ClassMirror get superclass; | 777 ClassMirror get superclass; |
| 760 | 778 |
| 761 /** | 779 /** |
| 762 * A list of mirrors on the superinterfaces of the reflectee. | 780 * A list of mirrors on the superinterfaces of the reflectee. |
| 763 */ | 781 */ |
| 764 List<ClassMirror> get superinterfaces; | 782 List<ClassMirror> get superinterfaces; |
| 765 | 783 |
| 766 /** | 784 /** |
| 767 * The mixin of this class. | 785 * The mixin of this class. |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 * and | 996 * and |
| 979 * (2) [:simpleName == other.simpleName:] and | 997 * (2) [:simpleName == other.simpleName:] and |
| 980 * [:owner == other.owner:]. | 998 * [:owner == other.owner:]. |
| 981 */ | 999 */ |
| 982 bool operator == (other); | 1000 bool operator == (other); |
| 983 } | 1001 } |
| 984 | 1002 |
| 985 /** | 1003 /** |
| 986 * A [TypedefMirror] represents a typedef in a Dart language program. | 1004 * A [TypedefMirror] represents a typedef in a Dart language program. |
| 987 */ | 1005 */ |
| 988 abstract class TypedefMirror implements ClassMirror { | 1006 abstract class TypedefMirror implements TypeMirror { |
| 989 /** | 1007 /** |
| 990 * The defining type for this typedef. | 1008 * The defining type for this typedef. |
| 991 * | 1009 * |
| 992 * For instance [:void f(int):] is the value for [:typedef void f(int):]. | 1010 * For instance [:void f(int):] is the referent for [:typedef void f(int):]. |
| 993 */ | 1011 */ |
| 994 TypeMirror get value; | 1012 TypeMirror get referent; |
| 995 } | 1013 } |
| 996 | 1014 |
| 997 /** | 1015 /** |
| 998 * A [MethodMirror] reflects a Dart language function, method, | 1016 * A [MethodMirror] reflects a Dart language function, method, |
| 999 * constructor, getter, or setter. | 1017 * constructor, getter, or setter. |
| 1000 */ | 1018 */ |
| 1001 abstract class MethodMirror implements DeclarationMirror { | 1019 abstract class MethodMirror implements DeclarationMirror { |
| 1002 /** | 1020 /** |
| 1003 * A mirror on the return type for the reflectee. | 1021 * A mirror on the return type for the reflectee. |
| 1004 */ | 1022 */ |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 * | 1402 * |
| 1385 * When used as metadata on an import of "dart:mirrors", this metadata does | 1403 * When used as metadata on an import of "dart:mirrors", this metadata does |
| 1386 * not apply to the library in which the annotation is used, but instead | 1404 * not apply to the library in which the annotation is used, but instead |
| 1387 * applies to the other libraries (all libraries if "*" is used). | 1405 * applies to the other libraries (all libraries if "*" is used). |
| 1388 */ | 1406 */ |
| 1389 final override; | 1407 final override; |
| 1390 | 1408 |
| 1391 const MirrorsUsed( | 1409 const MirrorsUsed( |
| 1392 {this.symbols, this.targets, this.metaTargets, this.override}); | 1410 {this.symbols, this.targets, this.metaTargets, this.override}); |
| 1393 } | 1411 } |
| OLD | NEW |