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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 236 |
237 bool every(bool f(E element)) => IterableMixinWorkaround.every(this, f); | 237 bool every(bool f(E element)) => IterableMixinWorkaround.every(this, f); |
238 | 238 |
239 Iterable<E> get reversed => IterableMixinWorkaround.reversedList(this); | 239 Iterable<E> get reversed => IterableMixinWorkaround.reversedList(this); |
240 | 240 |
241 void sort([int compare(E a, E b)]) { | 241 void sort([int compare(E a, E b)]) { |
242 checkMutable('sort'); | 242 checkMutable('sort'); |
243 IterableMixinWorkaround.sortList(this, compare); | 243 IterableMixinWorkaround.sortList(this, compare); |
244 } | 244 } |
245 | 245 |
246 void shuffle() { | 246 void shuffle([Random random]) { |
247 IterableMixinWorkaround.shuffleList(this); | 247 IterableMixinWorkaround.shuffleList(this, random); |
248 } | 248 } |
249 | 249 |
250 int indexOf(Object element, [int start = 0]) { | 250 int indexOf(Object element, [int start = 0]) { |
251 return IterableMixinWorkaround.indexOfList(this, element, start); | 251 return IterableMixinWorkaround.indexOfList(this, element, start); |
252 } | 252 } |
253 | 253 |
254 int lastIndexOf(Object element, [int start]) { | 254 int lastIndexOf(Object element, [int start]) { |
255 return IterableMixinWorkaround.lastIndexOfList(this, element, start); | 255 return IterableMixinWorkaround.lastIndexOfList(this, element, start); |
256 } | 256 } |
257 | 257 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 } | 305 } |
306 | 306 |
307 /** | 307 /** |
308 * Dummy subclasses that allow the backend to track more precise | 308 * Dummy subclasses that allow the backend to track more precise |
309 * information about arrays through their type. The CPA type inference | 309 * information about arrays through their type. The CPA type inference |
310 * relies on the fact that these classes do not override [] nor []=. | 310 * relies on the fact that these classes do not override [] nor []=. |
311 */ | 311 */ |
312 class JSMutableArray extends JSArray implements JSMutableIndexable {} | 312 class JSMutableArray extends JSArray implements JSMutableIndexable {} |
313 class JSFixedArray extends JSMutableArray {} | 313 class JSFixedArray extends JSMutableArray {} |
314 class JSExtendableArray extends JSMutableArray {} | 314 class JSExtendableArray extends JSMutableArray {} |
OLD | NEW |