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

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: Updated cf. comments. 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
« no previous file with comments | « pkg/compiler/lib/src/types/type_mask.dart ('k') | pkg/compiler/lib/src/world.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b4189767efb3e31b5fd7cf57b29a377af629b042 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,7 +124,11 @@ 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 && !child.subclasses().any(isRelatedTo)) {
continue;
}
if (needsComma) {
@@ -126,8 +136,11 @@ class ClassHierarchyNode {
} 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 +152,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();
}
« no previous file with comments | « pkg/compiler/lib/src/types/type_mask.dart ('k') | pkg/compiler/lib/src/world.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698