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

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

Issue 18837002: Move toString() to collection classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments. Created 7 years, 5 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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 272 }
273 return new _ByteDataView(buffer, offsetInBytes, length); 273 return new _ByteDataView(buffer, offsetInBytes, length);
274 } 274 }
275 } 275 }
276 276
277 277
278 // Based class for _TypedList that provides common methods for implementing 278 // Based class for _TypedList that provides common methods for implementing
279 // the collection and list interfaces. 279 // the collection and list interfaces.
280 280
281 abstract class _TypedListBase { 281 abstract class _TypedListBase {
282
282 // Method(s) implementing the Collection interface. 283 // Method(s) implementing the Collection interface.
283 bool contains(element) => IterableMixinWorkaround.contains(this, element); 284 bool contains(element) => IterableMixinWorkaround.contains(this, element);
284 285
285 void forEach(void f(num element)) { 286 void forEach(void f(num element)) {
286 var len = this.length; 287 var len = this.length;
287 for (var i = 0; i < len; i++) { 288 for (var i = 0; i < len; i++) {
288 f(this[i]); 289 f(this[i]);
289 } 290 }
290 } 291 }
291 292
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 IterableMixinWorkaround.setAllList(this, index, iterable); 498 IterableMixinWorkaround.setAllList(this, index, iterable);
498 } 499 }
499 500
500 void fillRange(int start, int end, [num fillValue]) { 501 void fillRange(int start, int end, [num fillValue]) {
501 IterableMixinWorkaround.fillRangeList(this, start, end, fillValue); 502 IterableMixinWorkaround.fillRangeList(this, start, end, fillValue);
502 } 503 }
503 504
504 505
505 // Method(s) implementing Object interface. 506 // Method(s) implementing Object interface.
506 507
507 String toString() { 508 String toString() => IterableMixinWorkaround.toStringList(this);
floitsch 2013/07/08 16:12:34 VM devs prefer not to use "=>".
zarah 2013/07/08 16:57:46 Done.
508 return ToString.iterableToString(this);
509 }
510
511 509
512 // Internal utility methods. 510 // Internal utility methods.
513 511
514 bool _setRange(int start, int length, Iterable from, int startFrom) 512 bool _setRange(int start, int length, Iterable from, int startFrom)
515 native "TypedData_setRange"; 513 native "TypedData_setRange";
516 } 514 }
517 515
518 516
519 abstract class _TypedList extends _TypedListBase implements ByteBuffer { 517 abstract class _TypedList extends _TypedListBase implements ByteBuffer {
520 // Default method implementing parts of the TypedData interface. 518 // Default method implementing parts of the TypedData interface.
(...skipping 2585 matching lines...) Expand 10 before | Expand all | Expand 10 after
3106 return value; 3104 return value;
3107 } 3105 }
3108 return object; 3106 return object;
3109 } 3107 }
3110 3108
3111 3109
3112 void _throwRangeError(int index, int length) { 3110 void _throwRangeError(int index, int length) {
3113 String message = "$index must be in the range [0..$length)"; 3111 String message = "$index must be in the range [0..$length)";
3114 throw new RangeError(message); 3112 throw new RangeError(message);
3115 } 3113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698