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

Unified Diff: pkg/compiler/lib/src/cps_ir/type_propagation.dart

Issue 1493673003: Allow null in more 'special' type rules. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/type_propagation.dart
diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
index ed828240df89c0046efe3f4d035178cd345318d2..8a4daba9fcc0099edb0f97a34fe1801d79662306 100644
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
@@ -387,7 +387,7 @@ class ConstantPropagationLattice {
AbstractConstantValue closedOnInt(AbstractConstantValue left,
AbstractConstantValue right) {
- if (isDefinitelyInt(left) && isDefinitelyInt(right)) {
+ if (isDefinitelyInt(left) && isDefinitelyInt(right, allowNull: true)) {
return nonConstant(typeSystem.intType);
}
return null;
@@ -395,7 +395,7 @@ class ConstantPropagationLattice {
AbstractConstantValue closedOnUint(AbstractConstantValue left,
AbstractConstantValue right) {
- if (isDefinitelyUint(left) && isDefinitelyUint(right)) {
+ if (isDefinitelyUint(left) && isDefinitelyUint(right, allowNull: true)) {
return nonConstant(typeSystem.uintType);
}
return null;
@@ -403,7 +403,7 @@ class ConstantPropagationLattice {
AbstractConstantValue closedOnUint31(AbstractConstantValue left,
AbstractConstantValue right) {
- if (isDefinitelyUint31(left) && isDefinitelyUint31(right)) {
+ if (isDefinitelyUint31(left) && isDefinitelyUint31(right, allowNull: true)) {
return nonConstant(typeSystem.uint31Type);
}
return null;
@@ -414,7 +414,8 @@ class ConstantPropagationLattice {
AbstractConstantValue folded = foldBinary(constantSystem.add, left, right);
if (folded != null) return folded;
if (isDefinitelyNum(left)) {
- if (isDefinitelyUint31(left) && isDefinitelyUint31(right)) {
+ if (isDefinitelyUint31(left) &&
+ isDefinitelyUint31(right, allowNull: true)) {
return nonConstant(typeSystem.uint32Type);
}
return closedOnUint(left, right) ?? closedOnInt(left, right);
@@ -450,7 +451,7 @@ class ConstantPropagationLattice {
if (isDefinitelyUint32(left) && isDefinitelyIntInRange(right, min: 2)) {
return nonConstant(typeSystem.uint31Type);
}
- if (isDefinitelyUint(right)) {
+ if (isDefinitelyUint(right, allowNull: true)) {
// `0` will be an exception, other values will shrink the result.
if (isDefinitelyUint31(left)) return nonConstant(typeSystem.uint31Type);
if (isDefinitelyUint32(left)) return nonConstant(typeSystem.uint32Type);
@@ -501,7 +502,8 @@ class ConstantPropagationLattice {
foldBinary(constantSystem.bitAnd, left, right);
if (folded != null) return folded;
if (isDefinitelyNum(left)) {
- if (isDefinitelyUint31(left) || isDefinitelyUint31(right)) {
+ if (isDefinitelyUint31(left) ||
+ isDefinitelyUint31(right, allowNull: true)) {
// Either 31-bit argument will truncate the other.
return nonConstant(typeSystem.uint31Type);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698