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

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

Issue 12380058: Remove HBoundedPotentialPrimitiveArray type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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 | « sdk/lib/_internal/compiler/implementation/ssa/types.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/types/type_mask.dart
diff --git a/sdk/lib/_internal/compiler/implementation/types/type_mask.dart b/sdk/lib/_internal/compiler/implementation/types/type_mask.dart
index e228620375245f381ba38afe1aa0f5cf7c3cffdd..ffc8d906782f1c2024aa7d9c95ff85eb20d83048 100644
--- a/sdk/lib/_internal/compiler/implementation/types/type_mask.dart
+++ b/sdk/lib/_internal/compiler/implementation/types/type_mask.dart
@@ -55,6 +55,26 @@ class TypeMask {
return isNullable ? this : new TypeMask.internal(base, flags | 1);
}
+ /**
+ * Returns whether or not this type mask contains the given type.
+ */
+ bool contains(DartType type, Compiler compiler) {
+ // TODO(kasperl): Get rid of this handling.
+ if (base.isMalformed) return isSubtype;
+ assert(!type.isMalformed);
+ ClassElement baseElement = base.element;
+ ClassElement typeElement = type.element;
+ if (isExact) {
+ return identical(baseElement, typeElement);
+ } else if (isSubclass) {
+ return typeElement.isSubclassOf(baseElement);
+ } else {
+ assert(isSubtype);
+ Set<ClassElement> subtypes = compiler.world.subtypes[baseElement];
+ return subtypes != null ? subtypes.contains(typeElement) : false;
+ }
+ }
+
// TODO(kasperl): This implementation is a bit sketchy, but it
// behaves the same as the old implementation on HType. The plan is
// to extend this and add proper testing of it.
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/types.dart ('k') | tests/compiler/dart2js/mock_compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698