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

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

Issue 12811010: - Introduce the notion of setter constraints in the type inferrer, where we record things like: fie… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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/ssa/types.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/types.dart (revision 20142)
+++ sdk/lib/_internal/compiler/implementation/ssa/types.dart (working copy)
@@ -195,6 +195,7 @@
bool canBePrimitiveNumber(Compiler compiler) => false;
bool canBePrimitiveString(Compiler compiler) => false;
bool canBePrimitiveArray(Compiler compiler) => false;
+ bool canBePrimitiveBoolean(Compiler compiler) => false;
/** A type is useful it is not unknown, not conflicting, and not null. */
bool isUseful() => !isUnknown() && !isConflicting() && !isNull();
@@ -267,6 +268,7 @@
bool canBePrimitiveNumber(Compiler compiler) => true;
bool canBePrimitiveString(Compiler compiler) => true;
bool canBePrimitiveArray(Compiler compiler) => true;
+ bool canBePrimitiveBoolean(Compiler compiler) => true;
DartType computeType(Compiler compiler) {
return compiler.objectClass.computeType(compiler);
@@ -284,6 +286,7 @@
bool canBePrimitiveNumber(Compiler compiler) => true;
bool canBePrimitiveString(Compiler compiler) => true;
bool canBePrimitiveArray(Compiler compiler) => true;
+ bool canBePrimitiveBoolean(Compiler compiler) => true;
DartType computeType(Compiler compiler) {
return compiler.objectClass.computeType(compiler);
@@ -341,6 +344,7 @@
const HBooleanOrNullType();
String toString() => "boolean or null";
bool isBooleanOrNull() => true;
+ bool canBePrimitiveBoolean(Compiler compiler) => true;
DartType computeType(Compiler compiler) {
JavaScriptBackend backend = compiler.backend;
@@ -358,6 +362,7 @@
bool isBooleanOrNull() => true;
String toString() => "boolean";
bool isExact() => true;
+ bool canBePrimitiveBoolean(Compiler compiler) => true;
DartType computeType(Compiler compiler) {
JavaScriptBackend backend = compiler.backend;
@@ -589,6 +594,7 @@
bool canBePrimitive(Compiler compiler) {
return canBePrimitiveNumber(compiler)
|| canBePrimitiveArray(compiler)
+ || canBePrimitiveBoolean(compiler)
|| canBePrimitiveString(compiler);
}
@@ -598,6 +604,12 @@
return mask.contains(jsNumberType, compiler);
}
+ bool canBePrimitiveBoolean(Compiler compiler) {
+ JavaScriptBackend backend = compiler.backend;
+ DartType jsBoolType = backend.jsBoolClass.computeType(compiler);
+ return mask.contains(jsBoolType, compiler);
+ }
+
bool canBePrimitiveArray(Compiler compiler) {
JavaScriptBackend backend = compiler.backend;
DartType jsArrayType = backend.jsArrayClass.rawType;

Powered by Google App Engine
This is Rietveld 408576698