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

Unified Diff: runtime/lib/integers.dart

Issue 1985823002: Cleanup various argument and range errors in double.dart and integers.dart. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: RangeError.range takes minValue and maxValue of type int, not num. Created 4 years, 7 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 | « runtime/lib/double.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/integers.dart
diff --git a/runtime/lib/integers.dart b/runtime/lib/integers.dart
index a103f23872837cd41f31e826acc10c6a75a835e6..a7722b06b30d7290d45e957e9cabbca60dccfe23 100644
--- a/runtime/lib/integers.dart
+++ b/runtime/lib/integers.dart
@@ -174,22 +174,21 @@ abstract class _IntegerImplementation {
num clamp(num lowerLimit, num upperLimit) {
if (lowerLimit is! num) {
- throw new ArgumentError.value(lowerLimit, "lowerLimit");
+ throw new ArgumentError.value(lowerLimit, "lowerLimit", "not a number");
}
if (upperLimit is! num) {
- throw new ArgumentError.value(upperLimit, "upperLimit");
+ throw new ArgumentError.value(upperLimit, "upperLimit", "not a number");
}
// Special case for integers.
- if (lowerLimit is int && upperLimit is int &&
- lowerLimit <= upperLimit) {
+ if (lowerLimit is int && upperLimit is int && lowerLimit <= upperLimit) {
if (this < lowerLimit) return lowerLimit;
if (this > upperLimit) return upperLimit;
return this;
}
// Generic case involving doubles, and invalid integer ranges.
if (lowerLimit.compareTo(upperLimit) > 0) {
- throw new RangeError.range(upperLimit, lowerLimit, null, "upperLimit");
+ throw new ArgumentError(lowerLimit);
}
if (lowerLimit.isNaN) return lowerLimit;
// Note that we don't need to care for -0.0 for the lower limit.
« no previous file with comments | « runtime/lib/double.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698