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

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

Issue 13863012: Refactor List.setRange function. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 7 years, 8 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
« no previous file with comments | « runtime/lib/growable_array.dart ('k') | runtime/tests/vm/dart/byte_array_optimized_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 _rangeCheck(this.length, start, length); 561 _rangeCheck(this.length, start, length);
562 List result = _createList(length); 562 List result = _createList(length);
563 result.setRange(0, length, this, start); 563 result.setRange(0, length, this, start);
564 return result; 564 return result;
565 } 565 }
566 566
567 Iterable getRange(int start, [int end]) { 567 Iterable getRange(int start, [int end]) {
568 return IterableMixinWorkaround.getRangeList(this, start, end); 568 return IterableMixinWorkaround.getRangeList(this, start, end);
569 } 569 }
570 570
571 void setRange(int start, int length, List from, [int startFrom = 0]) { 571 void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
572 if (!_setRange(start, length, from, startFrom)) { 572 if (!_setRange(start, end - start, iterable, skipCount)) {
573 IterableMixinWorkaround.setRangeList(this, start, 573 IterableMixinWorkaround.setRangeList(this, start,
574 length, from, startFrom); 574 end, iterable, skipCount);
575 } 575 }
576 } 576 }
577 577
578 578
579 // Method(s) implementing Object interface. 579 // Method(s) implementing Object interface.
580 580
581 String toString() { 581 String toString() {
582 return ToString.iterableToString(this); 582 return ToString.iterableToString(this);
583 } 583 }
584 584
585 585
586 // Internal utility methods. 586 // Internal utility methods.
587 587
588 bool _setRange(int start, int length, List from, startFrom) 588 bool _setRange(int start, int length, Iterable from, int startFrom)
589 native "TypedData_setRange"; 589 native "TypedData_setRange";
590 } 590 }
591 591
592 592
593 abstract class _TypedList extends _TypedListBase implements ByteBuffer { 593 abstract class _TypedList extends _TypedListBase implements ByteBuffer {
594 // Default method implementing parts of the TypedData interface. 594 // Default method implementing parts of the TypedData interface.
595 int get offsetInBytes { 595 int get offsetInBytes {
596 return 0; 596 return 0;
597 } 597 }
598 598
(...skipping 2568 matching lines...) Expand 10 before | Expand all | Expand 10 after
3167 return value; 3167 return value;
3168 } 3168 }
3169 return object; 3169 return object;
3170 } 3170 }
3171 3171
3172 3172
3173 void _throwRangeError(int index, int length) { 3173 void _throwRangeError(int index, int length) {
3174 String message = "$index must be in the range [0..$length)"; 3174 String message = "$index must be in the range [0..$length)";
3175 throw new RangeError(message); 3175 throw new RangeError(message);
3176 } 3176 }
OLDNEW
« no previous file with comments | « runtime/lib/growable_array.dart ('k') | runtime/tests/vm/dart/byte_array_optimized_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698