Chromium Code Reviews| Index: runtime/lib/array.dart |
| diff --git a/runtime/lib/array.dart b/runtime/lib/array.dart |
| index a953f71ea3f1fd6c675a2c3ca7c7a4f16ba618e4..f19096548c7aef9c50249016089f65b94c2507f6 100644 |
| --- a/runtime/lib/array.dart |
| +++ b/runtime/lib/array.dart |
| @@ -77,17 +77,19 @@ class _List<E> implements List<E> { |
| if (iterable is _List) { |
| _copyFromObjectArray(iterable, skipCount, start, length); |
| } else { |
| - List otherList; |
| - int otherStart; |
| if (iterable is List) { |
| - otherList = iterable; |
| - otherStart = skipCount; |
| + Arrays.copy(iterable, skipCount, this, start, length); |
| } else { |
| - otherList = |
| - iterable.skip(skipCount).take(length).toList(growable: false); |
| - otherStart = 0; |
| + Iterator it = iterable.iterator; |
|
floitsch
2013/10/10 13:04:53
Do this change in a separate CL.
|
| + while (skipCount > 0) { |
| + if (!it.moveNext()) return; |
| + skipCount--; |
| + } |
| + for (int i = start; i < end; i++) { |
| + if (it.moveNext()) return; |
| + this[i] = it.current; |
| + } |
| } |
| - Arrays.copy(otherList, otherStart, this, start, length); |
| } |
| } |