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 part of _interceptors; | 5 part of _interceptors; |
6 | 6 |
7 /** | 7 /** |
8 * The interceptor class for [List]. The compiler recognizes this | 8 * The interceptor class for [List]. The compiler recognizes this |
9 * class as an interceptor, and changes references to [:this:] to | 9 * class as an interceptor, and changes references to [:this:] to |
10 * actually use the receiver of the method, which is generated as an extra | 10 * actually use the receiver of the method, which is generated as an extra |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 206 } |
207 | 207 |
208 E reduce(E combine(E value, E element)) { | 208 E reduce(E combine(E value, E element)) { |
209 return IterableMixinWorkaround.reduce(this, combine); | 209 return IterableMixinWorkaround.reduce(this, combine); |
210 } | 210 } |
211 | 211 |
212 fold(initialValue, combine(previousValue, E element)) { | 212 fold(initialValue, combine(previousValue, E element)) { |
213 return IterableMixinWorkaround.fold(this, initialValue, combine); | 213 return IterableMixinWorkaround.fold(this, initialValue, combine); |
214 } | 214 } |
215 | 215 |
216 dynamic firstWhere(bool test(E value), {Object orElse()}) { | 216 E firstWhere(bool test(E value), {E orElse()}) { |
217 return IterableMixinWorkaround.firstWhere(this, test, orElse); | 217 return IterableMixinWorkaround.firstWhere(this, test, orElse); |
218 } | 218 } |
219 | 219 |
220 dynamic lastWhere(bool test(E value), {Object orElse()}) { | 220 E lastWhere(bool test(E value), {E orElse()}) { |
221 return IterableMixinWorkaround.lastWhereList(this, test, orElse); | 221 return IterableMixinWorkaround.lastWhereList(this, test, orElse); |
222 } | 222 } |
223 | 223 |
224 E singleWhere(bool test(E value)) { | 224 E singleWhere(bool test(E value)) { |
225 return IterableMixinWorkaround.singleWhere(this, test); | 225 return IterableMixinWorkaround.singleWhere(this, test); |
226 } | 226 } |
227 | 227 |
228 E elementAt(int index) { | 228 E elementAt(int index) { |
229 return this[index]; | 229 return this[index]; |
230 } | 230 } |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 380 } |
381 | 381 |
382 /** | 382 /** |
383 * Dummy subclasses that allow the backend to track more precise | 383 * Dummy subclasses that allow the backend to track more precise |
384 * information about arrays through their type. The CPA type inference | 384 * information about arrays through their type. The CPA type inference |
385 * relies on the fact that these classes do not override [] nor []=. | 385 * relies on the fact that these classes do not override [] nor []=. |
386 */ | 386 */ |
387 class JSMutableArray<E> extends JSArray<E> implements JSMutableIndexable {} | 387 class JSMutableArray<E> extends JSArray<E> implements JSMutableIndexable {} |
388 class JSFixedArray<E> extends JSMutableArray<E> {} | 388 class JSFixedArray<E> extends JSMutableArray<E> {} |
389 class JSExtendableArray<E> extends JSMutableArray<E> {} | 389 class JSExtendableArray<E> extends JSMutableArray<E> {} |
OLD | NEW |