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

Unified Diff: sdk/lib/_internal/lib/js_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: Created 6 years, 11 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
Index: sdk/lib/_internal/lib/js_mirrors.dart
diff --git a/sdk/lib/_internal/lib/js_mirrors.dart b/sdk/lib/_internal/lib/js_mirrors.dart
index 2d27bab0de872fe8d310e9e7111db6016bdb915c..77939218ee883f38102f0ed9ed5f10e2fddd1b1a 100644
--- a/sdk/lib/_internal/lib/js_mirrors.dart
+++ b/sdk/lib/_internal/lib/js_mirrors.dart
@@ -1555,6 +1555,18 @@ class JsClassMirror extends JsTypeMirror with JsObjectMirror
return createRuntimeType(_mangledName);
}
+ 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;
+ }
+
// TODO(ahe): Implement this.
Map<Symbol, MethodMirror> get instanceMembers
=> throw new UnimplementedError();
@@ -2156,6 +2168,9 @@ class JsFunctionTypeMirror extends BrokenClassMirror
}
// TODO(ahe): Implement this method.
+ bool isSubclassOf(ClassMirror other) => throw new UnimplementedError();
+
+ // TODO(ahe): Implement this method.
MethodMirror get callMethod => throw new UnimplementedError();
}

Powered by Google App Engine
This is Rietveld 408576698