| Index: runtime/lib/double.dart
|
| diff --git a/runtime/lib/double.dart b/runtime/lib/double.dart
|
| index 862aae66ab8114d6c53d5091a587c0a294941684..cbf955dc81a4d791d6cfd36ea6e780aefc2236a7 100644
|
| --- a/runtime/lib/double.dart
|
| +++ b/runtime/lib/double.dart
|
| @@ -117,8 +117,12 @@ class _Double implements double {
|
| double truncateToDouble() native "Double_truncate";
|
|
|
| num clamp(num lowerLimit, num upperLimit) {
|
| - if (lowerLimit is! num) throw new ArgumentError(lowerLimit);
|
| - if (upperLimit is! num) throw new ArgumentError(upperLimit);
|
| + if (lowerLimit is! num) {
|
| + throw new ArgumentError.value(lowerLimit, "lowerLimit", "not a number");
|
| + }
|
| + if (upperLimit is! num) {
|
| + throw new ArgumentError.value(upperLimit, "upperLimit", "not a number");
|
| + }
|
|
|
| if (lowerLimit.compareTo(upperLimit) > 0) {
|
| throw new ArgumentError(lowerLimit);
|
| @@ -166,11 +170,12 @@ class _Double implements double {
|
| // See ECMAScript-262, 15.7.4.5 for details.
|
|
|
| if (fractionDigits is! int) {
|
| - throw new ArgumentError(fractionDigits);
|
| + throw new ArgumentError.value(
|
| + fractionDigits, "fractionDigits", "not an integer");
|
| }
|
| // Step 2.
|
| if (fractionDigits < 0 || fractionDigits > 20) {
|
| - throw new RangeError(fractionDigits);
|
| + throw new RangeError.range(fractionDigits, 0, 20, "fractionDigits");
|
| }
|
|
|
| // Step 3.
|
| @@ -200,10 +205,11 @@ class _Double implements double {
|
| // Step 7.
|
| if (fractionDigits != null) {
|
| if (fractionDigits is! int) {
|
| - throw new ArgumentError(fractionDigits);
|
| + throw new ArgumentError.value(
|
| + fractionDigits, "fractionDigits", "not an integer");
|
| }
|
| if (fractionDigits < 0 || fractionDigits > 20) {
|
| - throw new RangeError(fractionDigits);
|
| + throw new RangeError.range(fractionDigits, 0, 20, "fractionDigits");
|
| }
|
| }
|
|
|
| @@ -227,11 +233,12 @@ class _Double implements double {
|
| // at the fractionDigits. In Dart we are consistent with toStringAsFixed and
|
| // look at the fractionDigits first.
|
|
|
| - if (precision is! int) throw new ArgumentError(precision);
|
| -
|
| + if (precision is! int) {
|
| + throw new ArgumentError.value(precision, "precision", "not an integer");
|
| + }
|
| // Step 8.
|
| if (precision < 1 || precision > 21) {
|
| - throw new RangeError(precision);
|
| + throw new RangeError.range(precision, 1, 21, "precision");
|
| }
|
|
|
| if (isNaN) return "NaN";
|
|
|