| OLD | NEW |
| 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 Loading... |
| 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 | |
| 283 // Method(s) implementing the Collection interface. | 282 // Method(s) implementing the Collection interface. |
| 284 bool contains(element) => IterableMixinWorkaround.contains(this, element); | 283 bool contains(element) => IterableMixinWorkaround.contains(this, element); |
| 285 | 284 |
| 286 void forEach(void f(num element)) { | 285 void forEach(void f(num element)) { |
| 287 var len = this.length; | 286 var len = this.length; |
| 288 for (var i = 0; i < len; i++) { | 287 for (var i = 0; i < len; i++) { |
| 289 f(this[i]); | 288 f(this[i]); |
| 290 } | 289 } |
| 291 } | 290 } |
| 292 | 291 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 } | 498 } |
| 500 | 499 |
| 501 void fillRange(int start, int end, [num fillValue]) { | 500 void fillRange(int start, int end, [num fillValue]) { |
| 502 IterableMixinWorkaround.fillRangeList(this, start, end, fillValue); | 501 IterableMixinWorkaround.fillRangeList(this, start, end, fillValue); |
| 503 } | 502 } |
| 504 | 503 |
| 505 | 504 |
| 506 // Method(s) implementing Object interface. | 505 // Method(s) implementing Object interface. |
| 507 | 506 |
| 508 String toString() { | 507 String toString() { |
| 509 return IterableMixinWorkaround.toStringIterable(this, '[', ']'); | 508 return ToString.iterableToString(this); |
| 510 } | 509 } |
| 511 | 510 |
| 512 | 511 |
| 513 // Internal utility methods. | 512 // Internal utility methods. |
| 514 | 513 |
| 515 bool _setRange(int start, int length, Iterable from, int startFrom) | 514 bool _setRange(int start, int length, Iterable from, int startFrom) |
| 516 native "TypedData_setRange"; | 515 native "TypedData_setRange"; |
| 517 } | 516 } |
| 518 | 517 |
| 519 | 518 |
| (...skipping 2587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3107 return value; | 3106 return value; |
| 3108 } | 3107 } |
| 3109 return object; | 3108 return object; |
| 3110 } | 3109 } |
| 3111 | 3110 |
| 3112 | 3111 |
| 3113 void _throwRangeError(int index, int length) { | 3112 void _throwRangeError(int index, int length) { |
| 3114 String message = "$index must be in the range [0..$length)"; | 3113 String message = "$index must be in the range [0..$length)"; |
| 3115 throw new RangeError(message); | 3114 throw new RangeError(message); |
| 3116 } | 3115 } |
| OLD | NEW |