Chromium Code Reviews| Index: sdk/lib/internal/lists.dart |
| diff --git a/sdk/lib/internal/lists.dart b/sdk/lib/internal/lists.dart |
| index f821616bd638ad8f2adaaa753547620e6f8c2d15..2037e377a08a401d1ae25a0a551c2a36e210ae39 100644 |
| --- a/sdk/lib/internal/lists.dart |
| +++ b/sdk/lib/internal/lists.dart |
| @@ -75,25 +75,15 @@ class Lists { |
| } |
| static void indicesCheck(List a, int start, int end) { |
| - if (start < 0 || start > a.length) { |
| - throw new RangeError.range(start, 0, a.length); |
| - } |
| - if (end != null && (end < start || end > a.length)) { |
| - throw new RangeError.range(end, start, a.length); |
| - } |
| + RangeError.checkValidRange(start, end, a.length); |
| } |
| static void rangeCheck(List a, int start, int length) { |
| - if (length < 0) { |
| - throw new ArgumentError("negative length $length"); |
| - } |
| - if (start < 0 ) { |
| - String message = "$start must be greater than or equal to 0"; |
| - throw new RangeError(message); |
| - } |
| + RangeError.checkNotNegative(length); |
| + RangeError.checkNotNegative(start); |
| if (start + length > a.length) { |
| - String message = "$start + $length must be in the range [0..${a.length})"; |
| - throw new RangeError(message); |
| + String message = "$start + $length must be in the range [0..${a.length}]"; |
| + throw new RangeError.range(length, 0, a.length - start, "length", message); |
|
Søren Gjesse
2014/11/20 13:56:29
Long line.
|
| } |
| } |
| } |