Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: runtime/lib/typeddata.dart

Issue 12817003: Change getRange to sublist. Make getRange deprecated. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } 427 }
428 428
429 List toList() { 429 List toList() {
430 return new List.from(this); 430 return new List.from(this);
431 } 431 }
432 432
433 Set toSet() { 433 Set toSet() {
434 return new Set.from(this); 434 return new Set.from(this);
435 } 435 }
436 436
437 List getRange(int start, int length) { 437 List sublist(int start, [int end]) {
438 if (end == null) end = length;
439 int length = end - start;
438 _rangeCheck(this.length, start, length); 440 _rangeCheck(this.length, start, length);
439 List result = _createList(length); 441 List result = _createList(length);
440 result.setRange(0, length, this, start); 442 result.setRange(0, length, this, start);
441 return result; 443 return result;
442 } 444 }
443 445
446 List getRange(int start, int length) {
447 return sublist(start, start + length);
448 }
449
444 void setRange(int start, int length, List from, [int startFrom = 0]) { 450 void setRange(int start, int length, List from, [int startFrom = 0]) {
445 IterableMixinWorkaround.setRangeList(this, start, length, from, startFrom); 451 IterableMixinWorkaround.setRangeList(this, start, length, from, startFrom);
446 } 452 }
447 453
448 // Method(s) implementing Object interface. 454 // Method(s) implementing Object interface.
449 455
450 String toString() { 456 String toString() {
451 return Collections.collectionToString(this); 457 return Collections.collectionToString(this);
452 } 458 }
453 } 459 }
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 _setUint16(index * Uint16List.BYTES_PER_ELEMENT, value); 1520 _setUint16(index * Uint16List.BYTES_PER_ELEMENT, value);
1515 } 1521 }
1516 1522
1517 static _ExternalUint16Array _new(int length) native 1523 static _ExternalUint16Array _new(int length) native
1518 "ExternalTypedData_Uint16Array_new"; 1524 "ExternalTypedData_Uint16Array_new";
1519 } 1525 }
1520 1526
1521 1527
1522 class _ExternalInt32Array extends _TypedList implements Int32List { 1528 class _ExternalInt32Array extends _TypedList implements Int32List {
1523 // Factory constructors. 1529 // Factory constructors.
1524 1530
1525 factory _ExternalInt32Array(int length) { 1531 factory _ExternalInt32Array(int length) {
1526 if (length < 0) { 1532 if (length < 0) {
1527 String message = "$length must be greater than 0"; 1533 String message = "$length must be greater than 0";
1528 throw new ArgumentError(message); 1534 throw new ArgumentError(message);
1529 } 1535 }
1530 return _new(length); 1536 return _new(length);
1531 } 1537 }
1532 1538
1533 1539
1534 // Method(s) implementing the List interface. 1540 // Method(s) implementing the List interface.
(...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after
2611 } 2617 }
2612 } 2618 }
2613 2619
2614 2620
2615 int _defaultIfNull(object, value) { 2621 int _defaultIfNull(object, value) {
2616 if (object == null) { 2622 if (object == null) {
2617 return value; 2623 return value;
2618 } 2624 }
2619 return object; 2625 return object;
2620 } 2626 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698