OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |