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

Unified Diff: pkg/compiler/lib/src/types/constants.dart

Issue 1638643003: dart2js: Repair a failing assert. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update the comment. Created 4 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/types/constants.dart
diff --git a/pkg/compiler/lib/src/types/constants.dart b/pkg/compiler/lib/src/types/constants.dart
index 112946520776b3fbf217c5ad5201982b698a3815..e7ecab17ab84b6e14b6079674b498e19d5073792 100644
--- a/pkg/compiler/lib/src/types/constants.dart
+++ b/pkg/compiler/lib/src/types/constants.dart
@@ -36,15 +36,15 @@ class ConstantValueTypeMasks extends ConstantValueVisitor<TypeMask, Compiler> {
@override
TypeMask visitDouble(DoubleConstantValue constant, Compiler compiler) {
- // We have to distinguish -0.0 from 0, but for all practical purposes
- // -0.0 is an integer.
- // TODO(17235): this kind of special casing should only happen in the
- // backend.
- if (constant.isMinusZero &&
- compiler.backend.constantSystem.isInt(constant)) {
- return compiler.typesTask.uint31Type;
+ // We have to recognize double constants that are 'is int'.
+ if (compiler.backend.constantSystem.isInt(constant)) {
+ if (constant.isMinusZero) {
+ return compiler.typesTask.uint31Type;
+ } else {
+ assert(constant.isPositiveInfinity || constant.isNegativeInfinity);
+ return compiler.typesTask.intType;
+ }
}
- assert(!compiler.backend.constantSystem.isInt(constant));
return compiler.typesTask.doubleType;
}
« 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