Chromium Code Reviews| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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; | |
|
ahe
2013/10/11 10:30:21
This is temporary, right?
rmacnak
2013/10/11 18:06:08
Right, this should also be subsumed by declaration
| |
| 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 Loading... | |
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |