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

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

Issue 126823004: Add TypeMirror.isSubtypeOf, TypeMirror.isAssignableTo, ClassMirror.isSubclassOf (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: mark source mirrors as failing Created 6 years, 10 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 | « sdk/lib/_internal/lib/js_mirrors.dart ('k') | tests/compiler/dart2js/dart2js.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 /** 667 /**
668 * A mirror on the original declaration of this type. 668 * A mirror on the original declaration of this type.
669 * 669 *
670 * For most classes, they are their own original declaration. For 670 * For most classes, they are their own original declaration. For
671 * generic classes, however, there is a distinction between the 671 * generic classes, however, there is a distinction between the
672 * original class declaration, which has unbound type variables, and 672 * original class declaration, which has unbound type variables, and
673 * the instantiations of generic classes, which have bound type 673 * the instantiations of generic classes, which have bound type
674 * variables. 674 * variables.
675 */ 675 */
676 TypeMirror get originalDeclaration; 676 TypeMirror get originalDeclaration;
677
678
679 /**
680 * Checks the subtype relationship, denoted by [:<::] in the language
681 * specification. This is the type relationship used in [:is:] test checks.
682 */
683 bool isSubtypeOf(TypeMirror other);
684
685 /**
686 * Checks the assignability relationship, denoted by [:<=>:] in the language
687 * specification. This is the type relationship tested on assignment in
688 * checked mode.
689 */
690 bool isAssignableTo(TypeMirror other);
677 } 691 }
678 692
679 /** 693 /**
680 * A [ClassMirror] reflects a Dart language class. 694 * A [ClassMirror] reflects a Dart language class.
681 */ 695 */
682 abstract class ClassMirror implements TypeMirror, ObjectMirror { 696 abstract class ClassMirror implements TypeMirror, ObjectMirror {
683 /** 697 /**
684 * Returns true if this mirror reflects a non-generic class or an instantiated 698 * Returns true if this mirror reflects a non-generic class or an instantiated
685 * generic class in the current isolate. Otherwise, returns false. 699 * generic class in the current isolate. Otherwise, returns false.
686 */ 700 */
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 * 836 *
823 * (r1, ..., rn, [p1 = d1, ..., pk = dk]) { 837 * (r1, ..., rn, [p1 = d1, ..., pk = dk]) {
824 * return this.invoke(name, [r1, ..., rn, p1, ..., pk]); 838 * return this.invoke(name, [r1, ..., rn, p1, ..., pk]);
825 * } 839 * }
826 * 840 *
827 * if m has required parameters r1, ..., rn, and optional positional 841 * if m has required parameters r1, ..., rn, and optional positional
828 * parameters p1, ..., pk with defaults d1, ..., dk. Otherwise, an 842 * parameters p1, ..., pk with defaults d1, ..., dk. Otherwise, an
829 * [ArgumentError] is thrown. 843 * [ArgumentError] is thrown.
830 */ 844 */
831 Function operator [](Symbol name); 845 Function operator [](Symbol name);
846
847 /**
848 * Returns whether the class denoted by the receiver is a subclass of the
849 * class denoted by the argument.
850 *
851 * Note that the subclass relationship is reflexive.
852 */
853 bool isSubclassOf(ClassMirror other);
832 } 854 }
833 855
834 /** 856 /**
835 * A [FunctionTypeMirror] represents the type of a function in the 857 * A [FunctionTypeMirror] represents the type of a function in the
836 * Dart language. 858 * Dart language.
837 */ 859 */
838 abstract class FunctionTypeMirror implements ClassMirror { 860 abstract class FunctionTypeMirror implements ClassMirror {
839 /** 861 /**
840 * Returns the return type of the reflectee. 862 * Returns the return type of the reflectee.
841 */ 863 */
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 * 1230 *
1209 * When used as metadata on an import of "dart:mirrors", this metadata does 1231 * When used as metadata on an import of "dart:mirrors", this metadata does
1210 * not apply to the library in which the annotation is used, but instead 1232 * not apply to the library in which the annotation is used, but instead
1211 * applies to the other libraries (all libraries if "*" is used). 1233 * applies to the other libraries (all libraries if "*" is used).
1212 */ 1234 */
1213 final override; 1235 final override;
1214 1236
1215 const MirrorsUsed( 1237 const MirrorsUsed(
1216 {this.symbols, this.targets, this.metaTargets, this.override}); 1238 {this.symbols, this.targets, this.metaTargets, this.override});
1217 } 1239 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/lib/js_mirrors.dart ('k') | tests/compiler/dart2js/dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698