Index: pkg/compiler/lib/src/universe/class_set.dart |
diff --git a/pkg/compiler/lib/src/universe/class_set.dart b/pkg/compiler/lib/src/universe/class_set.dart |
index 6cafa09f423bcf9ebed44c358b1217ebdafffc3e..c6d9a0efc35fa92d2cb0a075da0787070b8d4df6 100644 |
--- a/pkg/compiler/lib/src/universe/class_set.dart |
+++ b/pkg/compiler/lib/src/universe/class_set.dart |
@@ -102,7 +102,13 @@ class ClassHierarchyNode { |
} |
void printOn(StringBuffer sb, String indentation, |
- {bool instantiatedOnly: false}) { |
+ {bool instantiatedOnly: false, |
+ ClassElement withRespectTo}) { |
+ |
+ bool isRelatedTo(ClassElement subclass) { |
+ return subclass.implementsInterface(withRespectTo); |
+ } |
+ |
sb.write('$indentation$cls'); |
if (isDirectlyInstantiated) { |
sb.write(' directly'); |
@@ -118,16 +124,25 @@ class ClassHierarchyNode { |
for (Link<ClassHierarchyNode> link = _directSubclasses; |
!link.isEmpty; |
link = link.tail) { |
- if (instantiatedOnly && !link.head.isInstantiated) { |
+ ClassHierarchyNode child = link.head; |
+ if (instantiatedOnly && !child.isInstantiated) { |
continue; |
} |
+ if (withRespectTo != null) { |
floitsch
2015/10/13 12:15:42
if (withRespectTo != null && !child.subclasses().a
Johnni Winther
2015/10/13 13:06:37
Done.
|
+ if (!child.subclasses().any(isRelatedTo)) { |
+ continue; |
+ } |
+ } |
if (needsComma) { |
sb.write(',\n'); |
} else { |
sb.write('\n'); |
} |
- link.head.printOn( |
- sb, '$indentation ', instantiatedOnly: instantiatedOnly); |
+ child.printOn( |
+ sb, |
+ '$indentation ', |
+ instantiatedOnly: instantiatedOnly, |
+ withRespectTo: withRespectTo); |
needsComma = true; |
} |
if (needsComma) { |
@@ -139,9 +154,13 @@ class ClassHierarchyNode { |
} |
} |
- String dump({String indentation: '', bool instantiatedOnly: false}) { |
+ String dump({String indentation: '', |
+ bool instantiatedOnly: false, |
+ ClassElement withRespectTo}) { |
StringBuffer sb = new StringBuffer(); |
- printOn(sb, indentation, instantiatedOnly: instantiatedOnly); |
+ printOn(sb, indentation, |
+ instantiatedOnly: instantiatedOnly, |
+ withRespectTo: withRespectTo); |
return sb.toString(); |
} |