OLD | NEW |
1 // -- start List<$E> mixins. | 1 // -- start List<$E> mixins. |
2 // $E is the element type. | 2 // $E is the element type. |
3 | 3 |
4 // From Iterable<$E>: | 4 // From Iterable<$E>: |
5 | 5 |
6 Iterator<$E> get iterator { | 6 Iterator<$E> get iterator { |
7 // Note: NodeLists are not fixed size. And most probably length shouldn't | 7 // Note: NodeLists are not fixed size. And most probably length shouldn't |
8 // be cached in both iterator _and_ forEach method. For now caching it | 8 // be cached in both iterator _and_ forEach method. For now caching it |
9 // for consistency. | 9 // for consistency. |
10 return new FixedSizeListIterator<$E>(this); | 10 return new FixedSizeListIterator<$E>(this); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 164 } |
165 | 165 |
166 void removeWhere(bool test($E element)) { | 166 void removeWhere(bool test($E element)) { |
167 throw new UnsupportedError("Cannot remove from immutable List."); | 167 throw new UnsupportedError("Cannot remove from immutable List."); |
168 } | 168 } |
169 | 169 |
170 void retainWhere(bool test($E element)) { | 170 void retainWhere(bool test($E element)) { |
171 throw new UnsupportedError("Cannot remove from immutable List."); | 171 throw new UnsupportedError("Cannot remove from immutable List."); |
172 } | 172 } |
173 | 173 |
174 void setRange(int start, int end, Iterable<$E> iterable, [int skipCount]) { | 174 void setRange(int start, int end, Iterable<$E> iterable, [int skipCount=0]) { |
| 175 $if DEFINE_IMMUTABLE |
175 throw new UnsupportedError("Cannot setRange on immutable List."); | 176 throw new UnsupportedError("Cannot setRange on immutable List."); |
| 177 $else |
| 178 IterableMixinWorkaround.setRangeList(this, start, end, iterable, skipCount); |
| 179 $endif |
176 } | 180 } |
177 | 181 |
178 void removeRange(int start, int end) { | 182 void removeRange(int start, int end) { |
179 throw new UnsupportedError("Cannot removeRange on immutable List."); | 183 throw new UnsupportedError("Cannot removeRange on immutable List."); |
180 } | 184 } |
181 | 185 |
182 void replaceRange(int start, int end, Iterable<$E> iterable) { | 186 void replaceRange(int start, int end, Iterable<$E> iterable) { |
183 throw new UnsupportedError("Cannot modify an immutable List."); | 187 throw new UnsupportedError("Cannot modify an immutable List."); |
184 } | 188 } |
185 | 189 |
(...skipping 13 matching lines...) Expand all Loading... |
199 IterableMixinWorkaround.asMapList(this); | 203 IterableMixinWorkaround.asMapList(this); |
200 | 204 |
201 String toString() { | 205 String toString() { |
202 StringBuffer buffer = new StringBuffer('['); | 206 StringBuffer buffer = new StringBuffer('['); |
203 buffer.writeAll(this, ', '); | 207 buffer.writeAll(this, ', '); |
204 buffer.write(']'); | 208 buffer.write(']'); |
205 return buffer.toString(); | 209 return buffer.toString(); |
206 } | 210 } |
207 | 211 |
208 // -- end List<$E> mixins. | 212 // -- end List<$E> mixins. |
OLD | NEW |