| 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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 _rangeCheck(this.length, start, length); | 539 _rangeCheck(this.length, start, length); |
| 540 List result = _createList(length); | 540 List result = _createList(length); |
| 541 result.setRange(0, length, this, start); | 541 result.setRange(0, length, this, start); |
| 542 return result; | 542 return result; |
| 543 } | 543 } |
| 544 | 544 |
| 545 Iterable getRange(int start, [int end]) { | 545 Iterable getRange(int start, [int end]) { |
| 546 return IterableMixinWorkaround.getRangeList(this, start, end); | 546 return IterableMixinWorkaround.getRangeList(this, start, end); |
| 547 } | 547 } |
| 548 | 548 |
| 549 void setRange(int start, int length, List from, [int startFrom = 0]) { | 549 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) { |
| 550 if (!_setRange(start, length, from, startFrom)) { | 550 if (!_setRange(start, end - start, iterable, skipCount)) { |
| 551 IterableMixinWorkaround.setRangeList(this, start, | 551 IterableMixinWorkaround.setRangeList(this, start, |
| 552 length, from, startFrom); | 552 end, iterable, skipCount); |
| 553 } | 553 } |
| 554 } | 554 } |
| 555 | 555 |
| 556 | 556 |
| 557 // Method(s) implementing Object interface. | 557 // Method(s) implementing Object interface. |
| 558 | 558 |
| 559 String toString() { | 559 String toString() { |
| 560 return ToString.iterableToString(this); | 560 return ToString.iterableToString(this); |
| 561 } | 561 } |
| 562 | 562 |
| 563 | 563 |
| 564 // Internal utility methods. | 564 // Internal utility methods. |
| 565 | 565 |
| 566 bool _setRange(int start, int length, List from, startFrom) | 566 bool _setRange(int start, int length, Iterable from, int startFrom) |
| 567 native "TypedData_setRange"; | 567 native "TypedData_setRange"; |
| 568 } | 568 } |
| 569 | 569 |
| 570 | 570 |
| 571 abstract class _TypedList extends _TypedListBase implements ByteBuffer { | 571 abstract class _TypedList extends _TypedListBase implements ByteBuffer { |
| 572 // Default method implementing parts of the TypedData interface. | 572 // Default method implementing parts of the TypedData interface. |
| 573 int get offsetInBytes { | 573 int get offsetInBytes { |
| 574 return 0; | 574 return 0; |
| 575 } | 575 } |
| 576 | 576 |
| (...skipping 2568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3145 return value; | 3145 return value; |
| 3146 } | 3146 } |
| 3147 return object; | 3147 return object; |
| 3148 } | 3148 } |
| 3149 | 3149 |
| 3150 | 3150 |
| 3151 void _throwRangeError(int index, int length) { | 3151 void _throwRangeError(int index, int length) { |
| 3152 String message = "$index must be in the range [0..$length)"; | 3152 String message = "$index must be in the range [0..$length)"; |
| 3153 throw new RangeError(message); | 3153 throw new RangeError(message); |
| 3154 } | 3154 } |
| OLD | NEW |