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

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

Issue 14065011: Implement getRange (returning an Iterable). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address 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') | samples/swarm/swarm_ui_lib/observable/observable.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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « runtime/lib/growable_array.dart ('k') | samples/swarm/swarm_ui_lib/observable/observable.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698