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

Side by Side Diff: tools/dom/templates/immutable_list_mixin.darttemplate

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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 181 }
182 182
183 void removeRange(int start, int rangeLength) { 183 void removeRange(int start, int rangeLength) {
184 throw new UnsupportedError("Cannot removeRange on immutable List."); 184 throw new UnsupportedError("Cannot removeRange on immutable List.");
185 } 185 }
186 186
187 void insertRange(int start, int rangeLength, [$E initialValue]) { 187 void insertRange(int start, int rangeLength, [$E initialValue]) {
188 throw new UnsupportedError("Cannot insertRange on immutable List."); 188 throw new UnsupportedError("Cannot insertRange on immutable List.");
189 } 189 }
190 190
191 List<$E> sublist(int start, [int end]) {
192 if (end == null) end = length;
193 return Lists.getRange(this, start, end, <$E>[]);
194 }
195
191 List<$E> getRange(int start, int rangeLength) => 196 List<$E> getRange(int start, int rangeLength) =>
192 Lists.getRange(this, start, rangeLength, <$E>[]); 197 sublist(start, start + rangeLength);
193 198
194 Map<int, $E> asMap() => 199 Map<int, $E> asMap() =>
195 IterableMixinWorkaround.asMapList(this); 200 IterableMixinWorkaround.asMapList(this);
196 201
197 // -- end List<$E> mixins. 202 // -- end List<$E> mixins.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698