Chromium Code Reviews| 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 | |
| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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() { |
| 508 return ToString.iterableToString(this); | 509 return IterableMixinWorkaround.toStringList(this); |
| 509 } | 510 } |
| 510 | 511 |
| 511 | |
|
Lasse Reichstein Nielsen
2013/07/09 06:15:44
Why remove line?
zarah
2013/07/09 08:20:54
Added back.
| |
| 512 // Internal utility methods. | 512 // Internal utility methods. |
| 513 | 513 |
| 514 bool _setRange(int start, int length, Iterable from, int startFrom) | 514 bool _setRange(int start, int length, Iterable from, int startFrom) |
| 515 native "TypedData_setRange"; | 515 native "TypedData_setRange"; |
| 516 } | 516 } |
| 517 | 517 |
| 518 | 518 |
| 519 abstract class _TypedList extends _TypedListBase implements ByteBuffer { | 519 abstract class _TypedList extends _TypedListBase implements ByteBuffer { |
| 520 // Default method implementing parts of the TypedData interface. | 520 // Default method implementing parts of the TypedData interface. |
| 521 int get offsetInBytes { | 521 int get offsetInBytes { |
| (...skipping 2584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3106 return value; | 3106 return value; |
| 3107 } | 3107 } |
| 3108 return object; | 3108 return object; |
| 3109 } | 3109 } |
| 3110 | 3110 |
| 3111 | 3111 |
| 3112 void _throwRangeError(int index, int length) { | 3112 void _throwRangeError(int index, int length) { |
| 3113 String message = "$index must be in the range [0..$length)"; | 3113 String message = "$index must be in the range [0..$length)"; |
| 3114 throw new RangeError(message); | 3114 throw new RangeError(message); |
| 3115 } | 3115 } |
| OLD | NEW |