| Index: pkg/compiler/lib/src/js_backend/constant_system_javascript.dart
|
| diff --git a/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart b/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart
|
| index 290d563259dd393b4b5d0bda51b1008d7ca2f710..f6ebd0770f0861803484dc25f0068d81cbf37a09 100644
|
| --- a/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart
|
| +++ b/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart
|
| @@ -274,8 +274,17 @@ class JavaScriptConstantSystem extends ConstantSystem {
|
| compiler.backend.typeImplementation.computeType(compiler.resolution));
|
| }
|
|
|
| - // Integer checks don't verify that the number is not -0.0.
|
| - bool isInt(ConstantValue constant) => constant.isInt || constant.isMinusZero;
|
| + // Integer checks report true for -0.0, INFINITY, and -INFINITY. At
|
| + // runtime an 'X is int' check is implemented as:
|
| + //
|
| + // typeof(X) === "number" && Math.floor(X) === X
|
| + //
|
| + // We consistently match that runtime semantics at compile time as well.
|
| + bool isInt(ConstantValue constant) {
|
| + return constant.isInt || constant.isMinusZero ||
|
| + constant.isPositiveInfinity ||
|
| + constant.isNegativeInfinity;
|
| + }
|
| bool isDouble(ConstantValue constant)
|
| => constant.isDouble && !constant.isMinusZero;
|
| bool isString(ConstantValue constant) => constant.isString;
|
|
|