Index: sdk/lib/_internal/compiler/implementation/constant_system_dart.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/constant_system_dart.dart b/sdk/lib/_internal/compiler/implementation/constant_system_dart.dart |
index 7899d177860f6cfb82b23efa703dc841735b3644..75dce33b1fe28438fd3cf1849e6d9515e91c8be1 100644 |
--- a/sdk/lib/_internal/compiler/implementation/constant_system_dart.dart |
+++ b/sdk/lib/_internal/compiler/implementation/constant_system_dart.dart |
@@ -207,7 +207,11 @@ class TruncatingDivideOperation extends ArithmeticNumOperation { |
if (right == 0) return null; |
return left ~/ right; |
} |
- num foldNums(num left, num right) => left ~/ right; |
+ num foldNums(num left, num right) { |
+ num ratio = left / right; |
+ if (ratio.isNaN || ratio.isInfinite) return null; |
+ return ratio.truncate().toInt(); |
+ } |
apply(left, right) => left ~/ right; |
} |