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 patch class Int8List { | 7 patch class Int8List { |
8 /* patch */ factory Int8List(int length) { | 8 /* patch */ factory Int8List(int length) { |
9 return new _Int8Array(length); | 9 return new _Int8Array(length); |
10 } | 10 } |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 if (length == 1) return this[0]; | 513 if (length == 1) return this[0]; |
514 if (length == 0) throw new StateError("No elements"); | 514 if (length == 0) throw new StateError("No elements"); |
515 throw new StateError("More than one element"); | 515 throw new StateError("More than one element"); |
516 } | 516 } |
517 | 517 |
518 void removeRange(int start, int end) { | 518 void removeRange(int start, int end) { |
519 throw new UnsupportedError( | 519 throw new UnsupportedError( |
520 "Cannot remove from a non-extendable array"); | 520 "Cannot remove from a non-extendable array"); |
521 } | 521 } |
522 | 522 |
523 void insertRange(int start, int length, [initialValue]) { | |
524 throw new UnsupportedError( | |
525 "Cannot add to a non-extendable array"); | |
526 } | |
527 | |
528 List toList() { | 523 List toList() { |
529 return new List.from(this); | 524 return new List.from(this); |
530 } | 525 } |
531 | 526 |
532 Set toSet() { | 527 Set toSet() { |
533 return new Set.from(this); | 528 return new Set.from(this); |
534 } | 529 } |
535 | 530 |
536 List sublist(int start, [int end]) { | 531 List sublist(int start, [int end]) { |
537 if (end == null) end = length; | 532 if (end == null) end = length; |
(...skipping 2607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3145 return value; | 3140 return value; |
3146 } | 3141 } |
3147 return object; | 3142 return object; |
3148 } | 3143 } |
3149 | 3144 |
3150 | 3145 |
3151 void _throwRangeError(int index, int length) { | 3146 void _throwRangeError(int index, int length) { |
3152 String message = "$index must be in the range [0..$length)"; | 3147 String message = "$index must be in the range [0..$length)"; |
3153 throw new RangeError(message); | 3148 throw new RangeError(message); |
3154 } | 3149 } |
OLD | NEW |