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

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

Issue 12262037: Make List.skip, List.take and List.reversed return Iterables, not Lists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments, small fixes. Created 7 years, 10 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
« no previous file with comments | « tools/dom/templates/html/impl/impl_Node.darttemplate ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 $endif 100 $endif
101 101
102 $if DEFINE_CLEAR 102 $if DEFINE_CLEAR
103 void clear() { 103 void clear() {
104 throw new UnsupportedError("Cannot clear immutable List."); 104 throw new UnsupportedError("Cannot clear immutable List.");
105 } 105 }
106 $else 106 $else
107 // clear() defined by IDL. 107 // clear() defined by IDL.
108 $endif 108 $endif
109 109
110 List<$E> get reversed { 110 Iterable<$E> get reversed {
111 return IterableMixinWorkaround.reversedList(this); 111 return IterableMixinWorkaround.reversedList(this);
112 } 112 }
113 113
114 void sort([int compare($E a, $E b)]) { 114 void sort([int compare($E a, $E b)]) {
115 throw new UnsupportedError("Cannot sort immutable List."); 115 throw new UnsupportedError("Cannot sort immutable List.");
116 } 116 }
117 117
118 int indexOf($E element, [int start = 0]) => 118 int indexOf($E element, [int start = 0]) =>
119 Lists.indexOf(this, element, start, this.length); 119 Lists.indexOf(this, element, start, this.length);
120 120
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 182 }
183 183
184 void insertRange(int start, int rangeLength, [$E initialValue]) { 184 void insertRange(int start, int rangeLength, [$E initialValue]) {
185 throw new UnsupportedError("Cannot insertRange on immutable List."); 185 throw new UnsupportedError("Cannot insertRange on immutable List.");
186 } 186 }
187 187
188 List<$E> getRange(int start, int rangeLength) => 188 List<$E> getRange(int start, int rangeLength) =>
189 Lists.getRange(this, start, rangeLength, <$E>[]); 189 Lists.getRange(this, start, rangeLength, <$E>[]);
190 190
191 // -- end List<$E> mixins. 191 // -- end List<$E> mixins.
OLDNEW
« no previous file with comments | « tools/dom/templates/html/impl/impl_Node.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698