| 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 if (length > 0) return this[length - 1]; | 530 if (length > 0) return this[length - 1]; |
| 531 throw new StateError("No elements"); | 531 throw new StateError("No elements"); |
| 532 } | 532 } |
| 533 | 533 |
| 534 int get single { | 534 int get single { |
| 535 if (length == 1) return this[0]; | 535 if (length == 1) return this[0]; |
| 536 if (length == 0) throw new StateError("No elements"); | 536 if (length == 0) throw new StateError("No elements"); |
| 537 throw new StateError("More than one element"); | 537 throw new StateError("More than one element"); |
| 538 } | 538 } |
| 539 | 539 |
| 540 void removeRange(int start, int length) { | 540 void removeRange(int start, int end) { |
| 541 throw new UnsupportedError( | 541 throw new UnsupportedError( |
| 542 "Cannot remove from a non-extendable array"); | 542 "Cannot remove from a non-extendable array"); |
| 543 } | 543 } |
| 544 | 544 |
| 545 void insertRange(int start, int length, [initialValue]) { | |
| 546 throw new UnsupportedError( | |
| 547 "Cannot add to a non-extendable array"); | |
| 548 } | |
| 549 | |
| 550 List toList() { | 545 List toList() { |
| 551 return new List.from(this); | 546 return new List.from(this); |
| 552 } | 547 } |
| 553 | 548 |
| 554 Set toSet() { | 549 Set toSet() { |
| 555 return new Set.from(this); | 550 return new Set.from(this); |
| 556 } | 551 } |
| 557 | 552 |
| 558 List sublist(int start, [int end]) { | 553 List sublist(int start, [int end]) { |
| 559 if (end == null) end = length; | 554 if (end == null) end = length; |
| (...skipping 2607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3167 return value; | 3162 return value; |
| 3168 } | 3163 } |
| 3169 return object; | 3164 return object; |
| 3170 } | 3165 } |
| 3171 | 3166 |
| 3172 | 3167 |
| 3173 void _throwRangeError(int index, int length) { | 3168 void _throwRangeError(int index, int length) { |
| 3174 String message = "$index must be in the range [0..$length)"; | 3169 String message = "$index must be in the range [0..$length)"; |
| 3175 throw new RangeError(message); | 3170 throw new RangeError(message); |
| 3176 } | 3171 } |
| OLD | NEW |