Index: sdk/lib/_internal/compiler/implementation/mirrors/dart2js_type_mirrors.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_type_mirrors.dart b/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_type_mirrors.dart |
index 64c54c4e306437081712b03633042d64e5285563..3f5bfddffac18ba3a947c8ac4ad12b81746ae734 100644 |
--- a/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_type_mirrors.dart |
+++ b/sdk/lib/_internal/compiler/implementation/mirrors/dart2js_type_mirrors.dart |
@@ -54,6 +54,14 @@ abstract class Dart2JsTypeMirror |
bool get isDynamic => false; |
+ bool isSubtypeOf(TypeMirror other) { |
+ return mirrorSystem.compiler.types.isSubtype(this._type, other._type); |
+ } |
+ |
+ bool isAssignableTo(TypeMirror other) { |
+ return mirrorSystem.compiler.types.isAssignable(this._type, other._type); |
+ } |
+ |
String toString() => _type.toString(); |
} |
@@ -226,6 +234,18 @@ class Dart2JsClassDeclarationMirror |
InterfaceType type) |
: super(system, type); |
+ bool isSubclassOf(ClassMirror other) { |
+ if (other is! ClassMirror) throw new ArgumentError(other); |
+ ClassMirror otherDeclaration = other.originalDeclaration; |
+ ClassMirror c = this; |
+ while (c != null) { |
+ c = c.originalDeclaration; |
+ if (c == otherDeclaration) return true; |
+ c = c.superclass; |
+ } |
+ return false; |
+ } |
+ |
String toString() => 'Mirror on class ${_type.name}'; |
} |