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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 | 469 |
470 List sublist(int start, [int end]) { | 470 List sublist(int start, [int end]) { |
471 if (end == null) end = length; | 471 if (end == null) end = length; |
472 int length = end - start; | 472 int length = end - start; |
473 _rangeCheck(this.length, start, length); | 473 _rangeCheck(this.length, start, length); |
474 List result = _createList(length); | 474 List result = _createList(length); |
475 result.setRange(0, length, this, start); | 475 result.setRange(0, length, this, start); |
476 return result; | 476 return result; |
477 } | 477 } |
478 | 478 |
479 List getRange(int start, int length) { | 479 Iterable getRange(int start, [int end]) { |
480 return sublist(start, start + length); | 480 return IterableMixinWorkaround.getRangeList(this, start, end); |
481 } | 481 } |
482 | 482 |
483 void setRange(int start, int length, List from, [int startFrom = 0]) { | 483 void setRange(int start, int length, List from, [int startFrom = 0]) { |
484 if (!_setRange(start, length, from, startFrom)) { | 484 if (!_setRange(start, length, from, startFrom)) { |
485 IterableMixinWorkaround.setRangeList(this, start, | 485 IterableMixinWorkaround.setRangeList(this, start, |
486 length, from, startFrom); | 486 length, from, startFrom); |
487 } | 487 } |
488 } | 488 } |
489 | 489 |
490 | 490 |
(...skipping 2588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3079 return value; | 3079 return value; |
3080 } | 3080 } |
3081 return object; | 3081 return object; |
3082 } | 3082 } |
3083 | 3083 |
3084 | 3084 |
3085 void _throwRangeError(int index, int length) { | 3085 void _throwRangeError(int index, int length) { |
3086 String message = "$index must be in the range [0..$length)"; | 3086 String message = "$index must be in the range [0..$length)"; |
3087 throw new RangeError(message); | 3087 throw new RangeError(message); |
3088 } | 3088 } |
OLD | NEW |