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

Unified Diff: sdk/lib/_internal/compiler/implementation/types/type_mask.dart

Issue 14997006: Introduce a UnionTypeMask, currently limited to 4 types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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: sdk/lib/_internal/compiler/implementation/types/type_mask.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/types/type_mask.dart (revision 23010)
+++ sdk/lib/_internal/compiler/implementation/types/type_mask.dart (working copy)
@@ -28,6 +28,10 @@
factory TypeMask.nonNullSubtype(DartType base)
=> new FlatTypeMask.nonNullSubtype(base);
+ factory TypeMask.unionOf(Iterable<TypeMask> masks, Compiler compiler) {
+ return UnionTypeMask.unionOf(masks, compiler);
+ }
+
/**
* Returns a nullable variant of [this] type mask.
*/
@@ -38,9 +42,12 @@
*/
TypeMask nonNullable();
+ TypeMask simplify(Compiler compiler);
+
bool get isEmpty;
bool get isNullable;
bool get isExact;
+ bool get isUnion;
bool containsOnlyInt(Compiler compiler);
bool containsOnlyDouble(Compiler compiler);
@@ -49,6 +56,11 @@
bool containsOnlyBool(Compiler compiler);
bool containsOnlyString(Compiler compiler);
bool containsOnly(ClassElement element);
+
+ /**
+ * Returns whether this type mask is an instance of [cls].
+ */
+ bool satisfies(ClassElement cls, Compiler compiler);
/**
* Returns whether or not this type mask contains the given type.

Powered by Google App Engine
This is Rietveld 408576698