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

Side by Side Diff: runtime/lib/typed_data.dart

Issue 315173005: 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // patch classes for Int8List ..... Float64List and ByteData implementations. 5 // patch classes for Int8List ..... Float64List and ByteData implementations.
6 6
7 import "dart:_internal"; 7 import "dart:_internal";
8 import 'dart:math' show Random; 8 import 'dart:math' show Random;
9 9
10 patch class Int8List { 10 patch class Int8List {
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 402
403 bool get isNotEmpty => !isEmpty; 403 bool get isNotEmpty => !isEmpty;
404 404
405 // Method(s) implementing the List interface. 405 // Method(s) implementing the List interface.
406 406
407 set length(newLength) { 407 set length(newLength) {
408 throw new UnsupportedError( 408 throw new UnsupportedError(
409 "Cannot resize a fixed-length list"); 409 "Cannot resize a fixed-length list");
410 } 410 }
411 411
412 void set last(value) {
413 if (isEmpty) throw IterableElementError.noElement();
414 this[length - 1] = value;
415 }
416
412 void add(value) { 417 void add(value) {
413 throw new UnsupportedError( 418 throw new UnsupportedError(
414 "Cannot add to a fixed-length list"); 419 "Cannot add to a fixed-length list");
415 } 420 }
416 421
417 void addAll(Iterable value) { 422 void addAll(Iterable value) {
418 throw new UnsupportedError( 423 throw new UnsupportedError(
419 "Cannot add to a fixed-length list"); 424 "Cannot add to a fixed-length list");
420 } 425 }
421 426
(...skipping 3208 matching lines...) Expand 10 before | Expand all | Expand 10 after
3630 return value; 3635 return value;
3631 } 3636 }
3632 return object; 3637 return object;
3633 } 3638 }
3634 3639
3635 3640
3636 void _throwRangeError(int index, int length) { 3641 void _throwRangeError(int index, int length) {
3637 String message = "$index must be in the range [0..$length)"; 3642 String message = "$index must be in the range [0..$length)";
3638 throw new RangeError(message); 3643 throw new RangeError(message);
3639 } 3644 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698