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

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

Issue 11896013: Add List.reversed to give a reverse fixed-length view of a list. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Moved some functionality to separate CL. 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 | « samples/swarm/swarm_ui_lib/observable/observable.dart ('k') | sdk/lib/collection_dev/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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 throw new RangeError.value(start + length); 214 throw new RangeError.value(start + length);
215 } 215 }
216 216
217 Arrays.copy(from, startFrom, this, start, length); 217 Arrays.copy(from, startFrom, this, start, length);
218 } 218 }
219 219
220 bool any(bool f(E element)) => IterableMixinWorkaround.any(this, f); 220 bool any(bool f(E element)) => IterableMixinWorkaround.any(this, f);
221 221
222 bool every(bool f(E element)) => IterableMixinWorkaround.every(this, f); 222 bool every(bool f(E element)) => IterableMixinWorkaround.every(this, f);
223 223
224 List<E> get reversed => new ReversedListView<E>(this, 0, null);
225
224 void sort([int compare(E a, E b)]) { 226 void sort([int compare(E a, E b)]) {
225 checkMutable(this, 'sort'); 227 checkMutable(this, 'sort');
226 IterableMixinWorkaround.sortList(this, compare); 228 IterableMixinWorkaround.sortList(this, compare);
227 } 229 }
228 230
229 int indexOf(E element, [int start = 0]) { 231 int indexOf(E element, [int start = 0]) {
230 if (start is !int) throw new ArgumentError(start); 232 if (start is !int) throw new ArgumentError(start);
231 return Arrays.indexOf(this, element, start, length); 233 return Arrays.indexOf(this, element, start, length);
232 } 234 }
233 235
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 if (nextPosition < length) { 301 if (nextPosition < length) {
300 _position = nextPosition; 302 _position = nextPosition;
301 _current = _list[nextPosition]; 303 _current = _list[nextPosition];
302 return true; 304 return true;
303 } 305 }
304 _position = length; 306 _position = length;
305 _current = null; 307 _current = null;
306 return false; 308 return false;
307 } 309 }
308 } 310 }
OLDNEW
« no previous file with comments | « samples/swarm/swarm_ui_lib/observable/observable.dart ('k') | sdk/lib/collection_dev/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698