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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 | 504 |
505 Set toSet() { | 505 Set toSet() { |
506 return new Set.from(this); | 506 return new Set.from(this); |
507 } | 507 } |
508 | 508 |
509 Map<int, num> asMap() { | 509 Map<int, num> asMap() { |
510 return IterableMixinWorkaround.asMapList(this); | 510 return IterableMixinWorkaround.asMapList(this); |
511 } | 511 } |
512 | 512 |
513 List sublist(int start, [int end]) { | 513 List sublist(int start, [int end]) { |
514 if (end == null) end = length; | 514 if (end == null) end = this.length; |
515 int length = end - start; | 515 int length = end - start; |
516 _rangeCheck(this.length, start, length); | 516 _rangeCheck(this.length, start, length); |
517 List result = _createList(length); | 517 List result = _createList(length); |
518 result.setRange(0, length, this, start); | 518 result.setRange(0, length, this, start); |
519 return result; | 519 return result; |
520 } | 520 } |
521 | 521 |
522 Iterable getRange(int start, [int end]) { | 522 Iterable getRange(int start, [int end]) { |
523 return IterableMixinWorkaround.getRangeList(this, start, end); | 523 return IterableMixinWorkaround.getRangeList(this, start, end); |
524 } | 524 } |
(...skipping 2821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3346 return value; | 3346 return value; |
3347 } | 3347 } |
3348 return object; | 3348 return object; |
3349 } | 3349 } |
3350 | 3350 |
3351 | 3351 |
3352 void _throwRangeError(int index, int length) { | 3352 void _throwRangeError(int index, int length) { |
3353 String message = "$index must be in the range [0..$length)"; | 3353 String message = "$index must be in the range [0..$length)"; |
3354 throw new RangeError(message); | 3354 throw new RangeError(message); |
3355 } | 3355 } |
OLD | NEW |