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 | |
417 void add(value) { | 412 void add(value) { |
418 throw new UnsupportedError( | 413 throw new UnsupportedError( |
419 "Cannot add to a fixed-length list"); | 414 "Cannot add to a fixed-length list"); |
420 } | 415 } |
421 | 416 |
422 void addAll(Iterable value) { | 417 void addAll(Iterable value) { |
423 throw new UnsupportedError( | 418 throw new UnsupportedError( |
424 "Cannot add to a fixed-length list"); | 419 "Cannot add to a fixed-length list"); |
425 } | 420 } |
426 | 421 |
(...skipping 3208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3635 return value; | 3630 return value; |
3636 } | 3631 } |
3637 return object; | 3632 return object; |
3638 } | 3633 } |
3639 | 3634 |
3640 | 3635 |
3641 void _throwRangeError(int index, int length) { | 3636 void _throwRangeError(int index, int length) { |
3642 String message = "$index must be in the range [0..$length)"; | 3637 String message = "$index must be in the range [0..$length)"; |
3643 throw new RangeError(message); | 3638 throw new RangeError(message); |
3644 } | 3639 } |
OLD | NEW |