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

Side by Side Diff: sdk/lib/_internal/lib/js_array.dart

Issue 25931003: Make List.shuffle take an optional Random object to use. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. Created 7 years, 2 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 | « sdk/lib/_internal/lib/interceptors.dart ('k') | sdk/lib/collection/list.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 {}
OLDNEW
« no previous file with comments | « sdk/lib/_internal/lib/interceptors.dart ('k') | sdk/lib/collection/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698