| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 // TODO(srdjan): Use shared array implementation. | 6 // TODO(srdjan): Use shared array implementation. |
| 7 class _List<E> implements List<E> { | 7 class _List<E> implements List<E> { |
| 8 static final int _classId = (new _List(0))._cid; | 8 static final int _classId = (new _List(0))._cid; |
| 9 | 9 |
| 10 factory _List(length) native "List_allocate"; | 10 factory _List(length) native "List_allocate"; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 throw new UnsupportedError( | 29 throw new UnsupportedError( |
| 30 "Cannot add to a non-extendable array"); | 30 "Cannot add to a non-extendable array"); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void insertAll(int index, Iterable<E> iterable) { | 33 void insertAll(int index, Iterable<E> iterable) { |
| 34 throw new UnsupportedError( | 34 throw new UnsupportedError( |
| 35 "Cannot add to a non-extendable array"); | 35 "Cannot add to a non-extendable array"); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void setAll(int index, Iterable<E> iterable) { | 38 void setAll(int index, Iterable<E> iterable) { |
| 39 if (index < 0 || index > length) { | 39 IterableMixinWorkaround.setAllList(this, index, iterable); |
| 40 throw new RangeError.range(index, 0, length); | |
| 41 } | |
| 42 for (var element in iterable) { | |
| 43 [index++] = element; | |
| 44 } | |
| 45 } | 40 } |
| 46 | 41 |
| 47 E removeAt(int index) { | 42 E removeAt(int index) { |
| 48 throw new UnsupportedError( | 43 throw new UnsupportedError( |
| 49 "Cannot remove element of a non-extendable array"); | 44 "Cannot remove element of a non-extendable array"); |
| 50 } | 45 } |
| 51 | 46 |
| 52 bool remove(Object element) { | 47 bool remove(Object element) { |
| 53 throw new UnsupportedError( | 48 throw new UnsupportedError( |
| 54 "Cannot remove element of a non-extendable array"); | 49 "Cannot remove element of a non-extendable array"); |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 } | 560 } |
| 566 _position = _length; | 561 _position = _length; |
| 567 _current = null; | 562 _current = null; |
| 568 return false; | 563 return false; |
| 569 } | 564 } |
| 570 | 565 |
| 571 E get current { | 566 E get current { |
| 572 return _current; | 567 return _current; |
| 573 } | 568 } |
| 574 } | 569 } |
| OLD | NEW |