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

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: Rebase 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
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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 _rangeCheck(this.length, start, length); 480 _rangeCheck(this.length, start, length);
481 List result = _createList(length); 481 List result = _createList(length);
482 result.setRange(0, length, this, start); 482 result.setRange(0, length, this, start);
483 return result; 483 return result;
484 } 484 }
485 485
486 Iterable getRange(int start, [int end]) { 486 Iterable getRange(int start, [int end]) {
487 return IterableMixinWorkaround.getRangeList(this, start, end); 487 return IterableMixinWorkaround.getRangeList(this, start, end);
488 } 488 }
489 489
490 void setRange(int start, int length, List from, [int startFrom = 0]) { 490 void setRange(int start, int end, List from, [int startFrom = 0]) {
491 if (!_setRange(start, length, from, startFrom)) { 491 if (!_setRange(start, end - start, from, startFrom)) {
492 IterableMixinWorkaround.setRangeList(this, start, 492 IterableMixinWorkaround.setRangeList(this, start,
493 length, from, startFrom); 493 end, from, startFrom);
494 } 494 }
495 } 495 }
496 496
497 497
498 // Method(s) implementing Object interface. 498 // Method(s) implementing Object interface.
499 499
500 String toString() { 500 String toString() {
501 return Collections.collectionToString(this); 501 return Collections.collectionToString(this);
502 } 502 }
503 503
(...skipping 2582 matching lines...) Expand 10 before | Expand all | Expand 10 after
3086 return value; 3086 return value;
3087 } 3087 }
3088 return object; 3088 return object;
3089 } 3089 }
3090 3090
3091 3091
3092 void _throwRangeError(int index, int length) { 3092 void _throwRangeError(int index, int length) {
3093 String message = "$index must be in the range [0..$length)"; 3093 String message = "$index must be in the range [0..$length)";
3094 throw new RangeError(message); 3094 throw new RangeError(message);
3095 } 3095 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698