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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/lib/js_mirrors.dart ('k') | tests/compiler/dart2js/dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/mirrors/mirrors.dart
diff --git a/sdk/lib/mirrors/mirrors.dart b/sdk/lib/mirrors/mirrors.dart
index 1c4c799b6037b1d9070c495be354445323df769e..31e4cd3466614b2de387ee19fb2c47550863c23e 100644
--- a/sdk/lib/mirrors/mirrors.dart
+++ b/sdk/lib/mirrors/mirrors.dart
@@ -674,6 +674,20 @@ abstract class TypeMirror implements DeclarationMirror {
* variables.
*/
TypeMirror get originalDeclaration;
+
+
+ /**
+ * Checks the subtype relationship, denoted by [:<::] in the language
+ * specification. This is the type relationship used in [:is:] test checks.
+ */
+ bool isSubtypeOf(TypeMirror other);
+
+ /**
+ * Checks the assignability relationship, denoted by [:<=>:] in the language
+ * specification. This is the type relationship tested on assignment in
+ * checked mode.
+ */
+ bool isAssignableTo(TypeMirror other);
}
/**
@@ -829,6 +843,14 @@ abstract class ClassMirror implements TypeMirror, ObjectMirror {
* [ArgumentError] is thrown.
*/
Function operator [](Symbol name);
+
+ /**
+ * Returns whether the class denoted by the receiver is a subclass of the
+ * class denoted by the argument.
+ *
+ * Note that the subclass relationship is reflexive.
+ */
+ bool isSubclassOf(ClassMirror other);
}
/**
« 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