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

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

Issue 1604333002: Implement TypeMask.isDisjoint instead of using intersection. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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') | tests/compiler/dart2js/type_mask_disjoint_test.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 4a8397e3501b8be1ffa76bca02cbed2a9a57d0b2..24a019144a87e3d76477db32517f90d80fc4f17a 100644
--- a/pkg/compiler/lib/src/types/union_type_mask.dart
+++ b/pkg/compiler/lib/src/types/union_type_mask.dart
@@ -166,6 +166,13 @@ class UnionTypeMask implements TypeMask {
return new TypeMask.unionOf(intersections, classWorld);
}
+ bool isDisjoint(TypeMask other, ClassWorld classWorld) {
+ for (var current in disjointMasks) {
+ if (!current.isDisjoint(other, classWorld)) return false;
+ }
+ return true;
+ }
+
TypeMask nullable() {
if (isNullable) return this;
List<FlatTypeMask> newList = new List<FlatTypeMask>.from(disjointMasks);
« no previous file with comments | « pkg/compiler/lib/src/types/type_mask.dart ('k') | tests/compiler/dart2js/type_mask_disjoint_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698