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

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

Issue 331833003: Revert "Add "last" setter to List." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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-dev/swarm/swarm_ui_lib/observable/observable.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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 return JS('var', '#[#]', this, index); 357 return JS('var', '#[#]', this, index);
358 } 358 }
359 359
360 void operator []=(int index, E value) { 360 void operator []=(int index, E value) {
361 checkMutable('indexed set'); 361 checkMutable('indexed set');
362 if (index is !int) throw new ArgumentError(index); 362 if (index is !int) throw new ArgumentError(index);
363 if (index >= length || index < 0) throw new RangeError.value(index); 363 if (index >= length || index < 0) throw new RangeError.value(index);
364 JS('void', r'#[#] = #', this, index, value); 364 JS('void', r'#[#] = #', this, index, value);
365 } 365 }
366 366
367 void set last(E value) {
368 checkMutable('indexed set');
369 if (length == 0) throw IterableElementError.noElement();
370 JS('void', r'#[#] = #', this, this.length - 1, value);
371 }
372
373 Map<int, E> asMap() { 367 Map<int, E> asMap() {
374 return IterableMixinWorkaround.asMapList(this); 368 return IterableMixinWorkaround.asMapList(this);
375 } 369 }
376 } 370 }
377 371
378 /** 372 /**
379 * Dummy subclasses that allow the backend to track more precise 373 * Dummy subclasses that allow the backend to track more precise
380 * information about arrays through their type. The CPA type inference 374 * information about arrays through their type. The CPA type inference
381 * relies on the fact that these classes do not override [] nor []=. 375 * relies on the fact that these classes do not override [] nor []=.
382 */ 376 */
383 class JSMutableArray<E> extends JSArray<E> implements JSMutableIndexable {} 377 class JSMutableArray<E> extends JSArray<E> implements JSMutableIndexable {}
384 class JSFixedArray<E> extends JSMutableArray<E> {} 378 class JSFixedArray<E> extends JSMutableArray<E> {}
385 class JSExtendableArray<E> extends JSMutableArray<E> {} 379 class JSExtendableArray<E> extends JSMutableArray<E> {}
OLDNEW
« no previous file with comments | « samples-dev/swarm/swarm_ui_lib/observable/observable.dart ('k') | sdk/lib/collection/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698