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

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

Issue 12391046: Add List.asMap(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class Int8List { 5 patch class Int8List {
6 /* patch */ factory Int8List(int length) { 6 /* patch */ factory Int8List(int length) {
7 return new _Int8Array(length); 7 return new _Int8Array(length);
8 } 8 }
9 9
10 /* patch */ factory Int8List.transferable(int length) { 10 /* patch */ factory Int8List.transferable(int length) {
(...skipping 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 void removeRange(int start, int length) { 2040 void removeRange(int start, int length) {
2041 throw new UnsupportedError( 2041 throw new UnsupportedError(
2042 "Cannot remove from a non-extendable array"); 2042 "Cannot remove from a non-extendable array");
2043 } 2043 }
2044 2044
2045 void insertRange(int start, int length, [initialValue]) { 2045 void insertRange(int start, int length, [initialValue]) {
2046 throw new UnsupportedError( 2046 throw new UnsupportedError(
2047 "Cannot add to a non-extendable array"); 2047 "Cannot add to a non-extendable array");
2048 } 2048 }
2049 2049
2050 Map<int, int> asMap() {
2051 return IterableMixinWorkaround.asMapList(this);
2052 }
2053
2050 final ByteArray _array; 2054 final ByteArray _array;
2051 final int _offset; 2055 final int _offset;
2052 final int length; 2056 final int length;
2053 } 2057 }
2054 2058
2055 2059
2056 class _Int8ArrayView extends _ByteArrayViewBase implements Int8List { 2060 class _Int8ArrayView extends _ByteArrayViewBase implements Int8List {
2057 _Int8ArrayView(ByteArray array, [int offsetInBytes = 0, int _length]) 2061 _Int8ArrayView(ByteArray array, [int offsetInBytes = 0, int _length])
2058 : super(array, _requireInteger(offsetInBytes), 2062 : super(array, _requireInteger(offsetInBytes),
2059 _requireIntegerOrNull( 2063 _requireIntegerOrNull(
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
2684 ByteArray asByteArray([int start = 0, int length]) { 2688 ByteArray asByteArray([int start = 0, int length]) {
2685 if (length == null) { 2689 if (length == null) {
2686 length = this.lengthInBytes(); 2690 length = this.lengthInBytes();
2687 } 2691 }
2688 _rangeCheck(this.length, start, length); 2692 _rangeCheck(this.length, start, length);
2689 return _array.subByteArray(_offset + start, length); 2693 return _array.subByteArray(_offset + start, length);
2690 } 2694 }
2691 2695
2692 static const int _BYTES_PER_ELEMENT = 8; 2696 static const int _BYTES_PER_ELEMENT = 8;
2693 } 2697 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698