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

Unified Diff: pkg/smoke/lib/mirrors.dart

Issue 180273004: Fixes in smoke, which in turn should fix todomvc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « pkg/polymer/lib/src/declaration.dart ('k') | pkg/smoke/lib/smoke.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/smoke/lib/mirrors.dart
diff --git a/pkg/smoke/lib/mirrors.dart b/pkg/smoke/lib/mirrors.dart
index bcaa42ab99ae4cfebfb2314b2a53c83e16a0ac38..4048aae776af947957faf1d8fe94e31bcb4cbd8d 100644
--- a/pkg/smoke/lib/mirrors.dart
+++ b/pkg/smoke/lib/mirrors.dart
@@ -67,6 +67,19 @@ class ReflectiveObjectAccessorService implements ObjectAccessorService {
/// Implements [TypeInspectorService] using mirrors.
class ReflectiveTypeInspectorService implements TypeInspectorService {
+ bool isSubclassOf(Type type, Type supertype) {
+ if (type == supertype || supertype == Object) return true;
+ // TODO(sigmund): change to mirror.isSubclassOf when it gets implemented in
+ // dart2js. (dartbug.com/12439)
+ var mirror = reflectClass(type);
+ var top = reflectClass(supertype);
+ while (mirror != _objectType) {
+ mirror = _safeSuperclass(mirror);
+ if (mirror == top) return true;
+ }
+ return false;
+ }
+
bool hasGetter(Type type, Symbol name) {
var mirror = reflectType(type);
if (mirror is! ClassMirror) return false;
@@ -137,8 +150,12 @@ class ReflectiveTypeInspectorService implements TypeInspectorService {
}
List<Declaration> _query(ClassMirror cls, QueryOptions options) {
- var result = (!options.includeInherited || cls.superclass == _objectType)
- ? [] : _query(cls.superclass, options);
+ final visitParent = options.includeInherited && cls.superclass != null &&
+ // TODO(sigmund): use _toType(cls.superclass) != options.includeUpTo
+ // when dartbug.com/16925 gets fixed (_toType fails in dart2js if
+ // applied to classes with type-arguments).
+ cls.superclass != reflectClass(options.includeUpTo);
+ var result = visitParent ? _query(cls.superclass, options) : [];
for (var member in cls.declarations.values) {
if (member is! VariableMirror && member is! MethodMirror) continue;
if (member.isStatic || member.isPrivate) continue;
« no previous file with comments | « pkg/polymer/lib/src/declaration.dart ('k') | pkg/smoke/lib/smoke.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698