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

Unified Diff: pkg/compiler/lib/src/universe/class_set.dart

Issue 1402913003: Avoid creating invalid TypeMask.nonNullExact (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanup Created 5 years, 2 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: 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();
}

Powered by Google App Engine
This is Rietveld 408576698