Index: runtime/lib/growable_array.dart |
diff --git a/runtime/lib/growable_array.dart b/runtime/lib/growable_array.dart |
index 4daf8bb9543edb0a003bad6d6443165c5cafe4fb..db020ad7ca18e0ba3ef77b955d15bca014a94dec 100644 |
--- a/runtime/lib/growable_array.dart |
+++ b/runtime/lib/growable_array.dart |
@@ -108,15 +108,19 @@ class _GrowableObjectArray<T> implements List<T> { |
} |
} |
- List<T> getRange(int start, int length) { |
- if (length == 0) return []; |
- Arrays.rangeCheck(this, start, length); |
+ List<T> sublist(int start, [int end]) { |
+ Arrays.indicesCheck(this, start, end); |
+ if (end == null) end = length; |
+ int length = end - start; |
+ if (start == end) return <T>[]; |
List list = new _GrowableObjectArray<T>.withCapacity(length); |
list.length = length; |
Arrays.copy(this, start, list, 0, length); |
return list; |
} |
+ List<T> getRange(int start, int length) => sublist(start, start + length); |
+ |
factory _GrowableObjectArray(int length) { |
var data = new _ObjectArray((length == 0) ? 4 : length); |
var result = new _GrowableObjectArray<T>.withData(data); |