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

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

Issue 11817059: Fixes for a number of dart analyzer issues in dart:html. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Syncing to latest. Created 7 years, 11 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 18 matching lines...) Expand all
29 String join([String separator]) => Collections.joinList(this, separator); 29 String join([String separator]) => Collections.joinList(this, separator);
30 30
31 List mappedBy(f($E element)) => new MappedList<$E, dynamic>(this, f); 31 List mappedBy(f($E element)) => new MappedList<$E, dynamic>(this, f);
32 32
33 Iterable<$E> where(bool f($E element)) => new WhereIterable<$E>(this, f); 33 Iterable<$E> where(bool f($E element)) => new WhereIterable<$E>(this, f);
34 34
35 bool every(bool f($E element)) => Collections.every(this, f); 35 bool every(bool f($E element)) => Collections.every(this, f);
36 36
37 bool any(bool f($E element)) => Collections.any(this, f); 37 bool any(bool f($E element)) => Collections.any(this, f);
38 38
39 List<$E> toList() => new List<$E>.from(this);
40 Set<$E> toSet() => new Set<$E>.from(this);
41
39 bool get isEmpty => this.length == 0; 42 bool get isEmpty => this.length == 0;
40 43
41 List<$E> take(int n) => new ListView<$E>(this, 0, n); 44 List<$E> take(int n) => new ListView<$E>(this, 0, n);
42 45
43 Iterable<$E> takeWhile(bool test($E value)) { 46 Iterable<$E> takeWhile(bool test($E value)) {
44 return new TakeWhileIterable<$E>(this, test); 47 return new TakeWhileIterable<$E>(this, test);
45 } 48 }
46 49
47 List<$E> skip(int n) => new ListView<$E>(this, n, null); 50 List<$E> skip(int n) => new ListView<$E>(this, n, null);
48 51
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 if (this.length > 0) return this[this.length - 1]; 119 if (this.length > 0) return this[this.length - 1];
117 throw new StateError("No elements"); 120 throw new StateError("No elements");
118 } 121 }
119 122
120 $E get single { 123 $E get single {
121 if (length == 1) return this[0]; 124 if (length == 1) return this[0];
122 if (length == 0) throw new StateError("No elements"); 125 if (length == 0) throw new StateError("No elements");
123 throw new StateError("More than one element"); 126 throw new StateError("More than one element");
124 } 127 }
125 128
126 $E min([int compare($E a, $E b)]) => _Collections.minInList(this, compare); 129 $E min([int compare($E a, $E b)]) => Collections.min(this, compare);
127 130
128 $E max([int compare($E a, $E b)]) => _Collections.maxInList(this, compare); 131 $E max([int compare($E a, $E b)]) => Collections.max(this, compare);
129 132
130 $E removeAt(int pos) { 133 $E removeAt(int pos) {
131 throw new UnsupportedError("Cannot removeAt on immutable List."); 134 throw new UnsupportedError("Cannot removeAt on immutable List.");
132 } 135 }
133 136
134 $E removeLast() { 137 $E removeLast() {
135 throw new UnsupportedError("Cannot removeLast on immutable List."); 138 throw new UnsupportedError("Cannot removeLast on immutable List.");
136 } 139 }
137 140
138 void setRange(int start, int rangeLength, List<$E> from, [int startFrom]) { 141 void setRange(int start, int rangeLength, List<$E> from, [int startFrom]) {
139 throw new UnsupportedError("Cannot setRange on immutable List."); 142 throw new UnsupportedError("Cannot setRange on immutable List.");
140 } 143 }
141 144
142 void removeRange(int start, int rangeLength) { 145 void removeRange(int start, int rangeLength) {
143 throw new UnsupportedError("Cannot removeRange on immutable List."); 146 throw new UnsupportedError("Cannot removeRange on immutable List.");
144 } 147 }
145 148
146 void insertRange(int start, int rangeLength, [$E initialValue]) { 149 void insertRange(int start, int rangeLength, [$E initialValue]) {
147 throw new UnsupportedError("Cannot insertRange on immutable List."); 150 throw new UnsupportedError("Cannot insertRange on immutable List.");
148 } 151 }
149 152
150 List<$E> getRange(int start, int rangeLength) => 153 List<$E> getRange(int start, int rangeLength) =>
151 Lists.getRange(this, start, rangeLength, <$E>[]); 154 Lists.getRange(this, start, rangeLength, <$E>[]);
152 155
153 // -- end List<$E> mixins. 156 // -- 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