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

Unified Diff: lib/compiler/implementation/ssa/types.dart

Issue 10700104: Fix more type intersection stuff. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 | « no previous file | tests/compiler/dart2js/type_combination_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/types.dart
diff --git a/lib/compiler/implementation/ssa/types.dart b/lib/compiler/implementation/ssa/types.dart
index b3fa03d48ddcdab6421071aa4baa950a78adcb7e..3c20c93c612d5df9719854e80e0e93e6e59bb9d9 100644
--- a/lib/compiler/implementation/ssa/types.dart
+++ b/lib/compiler/implementation/ssa/types.dart
@@ -40,7 +40,7 @@ abstract class HType {
}
}
- static final HType CONFLICTING = const HAnalysisType("conflicting");
+ static final HType CONFLICTING = const HConflictingType();
static final HType UNKNOWN = const HAnalysisType("unknown");
static final HType BOOLEAN = const HBooleanType();
static final HType NUMBER = const HNumberType();
@@ -139,6 +139,12 @@ class HAnalysisType extends HType {
HType intersection(HType other) => combine(other);
}
+class HConflictingType extends HAnalysisType {
+ const HConflictingType() : super("conflicting");
+ bool canBePrimitive() => false;
+ bool canBeNull() => false;
+}
+
abstract class HPrimitiveType extends HType {
const HPrimitiveType();
bool isPrimitive() => true;
@@ -310,7 +316,7 @@ class HIntegerOrNullType extends HNumberOrNullType {
if (other.isIntegerOrNull()) return HType.INTEGER_OR_NULL;
if (other.isInteger()) return HType.INTEGER;
if (other.isDouble()) return HType.CONFLICTING;
- if (other.isDoubleOrNull()) return HType.CONFLICTING;
+ if (other.isDoubleOrNull()) return HType.NULL;
if (other.isNumber()) return HType.INTEGER;
if (other.isNumberOrNull()) return HType.INTEGER_OR_NULL;
if (other.canBeNull()) return HType.NULL;
@@ -370,7 +376,7 @@ class HDoubleOrNullType extends HNumberOrNullType {
HType intersection(HType other) {
if (other.isUnknown()) return HType.DOUBLE_OR_NULL;
- if (other.isIntegerOrNull()) return HType.CONFLICTING;
+ if (other.isIntegerOrNull()) return HType.NULL;
if (other.isInteger()) return HType.CONFLICTING;
if (other.isDouble()) return HType.DOUBLE;
if (other.isDoubleOrNull()) return HType.DOUBLE_OR_NULL;
« no previous file with comments | « no previous file | tests/compiler/dart2js/type_combination_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698