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

Unified Diff: sdk/lib/html/html_common/lists.dart

Issue 12817003: Change getRange to sublist. Make getRange deprecated. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 9 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
Index: sdk/lib/html/html_common/lists.dart
diff --git a/sdk/lib/html/html_common/lists.dart b/sdk/lib/html/html_common/lists.dart
index 874039e05c399191c8ad71b4121c87cc844c9217..b565aba49dba19e4cdf19874dcc46adebbc9c8e2 100644
--- a/sdk/lib/html/html_common/lists.dart
+++ b/sdk/lib/html/html_common/lists.dart
@@ -51,15 +51,14 @@ class Lists {
/**
* Returns a sub list copy of this list, from [start] to
- * [:start + length:].
+ * [end] ([end] not inclusive).
* Returns an empty list if [length] is 0.
- * Throws an [ArgumentError] if [length] is negative.
- * Throws a [RangeError] if [start] or [:start + length:] are out of range.
+ * It is an error if indices are not valid for the list, or
+ * if [end] is before [start].
*/
- static List getRange(List a, int start, int length, List accumulator) {
- if (length < 0) throw new ArgumentError('length');
+ static List getRange(List a, int start, int end, List accumulator) {
if (start < 0) throw new RangeError.value(start);
- int end = start + length;
+ if (end < start) throw new RangeError.value(end);
if (end > a.length) throw new RangeError.value(end);
for (int i = start; i < end; i++) {
accumulator.add(a[i]);

Powered by Google App Engine
This is Rietveld 408576698