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

Unified Diff: pkg/compiler/lib/src/types/union_type_mask.dart

Issue 2420073002: Decouple TypeMask from ClassElement (Closed)
Patch Set: Updated cf. comments. Created 4 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/types/union_type_mask.dart
diff --git a/pkg/compiler/lib/src/types/union_type_mask.dart b/pkg/compiler/lib/src/types/union_type_mask.dart
index 8e4aa394c861653c438261542928a83902cba4b3..8ba9a6ad3fb02ce450f74c40f1dd51f9e116f6fe 100644
--- a/pkg/compiler/lib/src/types/union_type_mask.dart
+++ b/pkg/compiler/lib/src/types/union_type_mask.dart
@@ -94,15 +94,14 @@ class UnionTypeMask implements TypeMask {
bool useSubclass = masks.every((e) => !e.isSubtype);
bool isNullable = masks.any((e) => e.isNullable);
- List<ClassElement> masksBases = masks.map((mask) => mask.base).toList();
- Iterable<ClassElement> candidates =
- closedWorld.commonSupertypesOf(masksBases);
+ List masksBases = masks.map((mask) => mask.base).toList();
+ Iterable<Entity> candidates = closedWorld.commonSupertypesOf(masksBases);
// Compute the best candidate and its kind.
- ClassElement bestElement;
+ Entity bestElement;
int bestKind;
int bestSize;
- for (ClassElement candidate in candidates) {
+ for (Entity candidate in candidates) {
bool isInstantiatedStrictSubclass(cls) =>
cls != candidate &&
closedWorld.isDirectlyInstantiated(cls) &&
@@ -231,14 +230,14 @@ class UnionTypeMask implements TypeMask {
// Check we cover the base class.
if (!contains(flat.base, closedWorld)) return false;
// Check for other members.
- Iterable<ClassElement> members;
+ Iterable<Entity> members;
if (flat.isSubclass) {
members = closedWorld.strictSubclassesOf(flat.base);
} else {
assert(flat.isSubtype);
members = closedWorld.strictSubtypesOf(flat.base);
}
- return members.every((ClassElement cls) => this.contains(cls, closedWorld));
+ return members.every((Entity cls) => this.contains(cls, closedWorld));
}
bool isInMask(TypeMask other, ClosedWorld closedWorld) {
@@ -306,23 +305,23 @@ class UnionTypeMask implements TypeMask {
return disjointMasks.every((mask) => mask.containsOnlyString(closedWorld));
}
- bool containsOnly(ClassElement element) {
+ bool containsOnly(Entity element) {
return disjointMasks.every((mask) => mask.containsOnly(element));
}
- bool satisfies(ClassElement cls, ClosedWorld closedWorld) {
+ bool satisfies(Entity cls, ClosedWorld closedWorld) {
return disjointMasks.every((mask) => mask.satisfies(cls, closedWorld));
}
- bool contains(ClassElement type, ClosedWorld closedWorld) {
- return disjointMasks.any((e) => e.contains(type, closedWorld));
+ bool contains(Entity cls, ClosedWorld closedWorld) {
+ return disjointMasks.any((e) => e.contains(cls, closedWorld));
}
bool containsAll(ClosedWorld closedWorld) {
return disjointMasks.any((mask) => mask.containsAll(closedWorld));
}
- ClassElement singleClass(ClosedWorld closedWorld) => null;
+ Entity singleClass(ClosedWorld closedWorld) => null;
bool needsNoSuchMethodHandling(Selector selector, ClosedWorld closedWorld) {
return disjointMasks
« 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