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

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: Address comments. 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
« no previous file with comments | « runtime/lib/array.dart ('k') | runtime/lib/growable_array.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) 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 2048 matching lines...) Expand 10 before | Expand all | Expand 10 after
2059 void removeRange(int start, int length) { 2059 void removeRange(int start, int length) {
2060 throw new UnsupportedError( 2060 throw new UnsupportedError(
2061 "Cannot remove from a non-extendable array"); 2061 "Cannot remove from a non-extendable array");
2062 } 2062 }
2063 2063
2064 void insertRange(int start, int length, [initialValue]) { 2064 void insertRange(int start, int length, [initialValue]) {
2065 throw new UnsupportedError( 2065 throw new UnsupportedError(
2066 "Cannot add to a non-extendable array"); 2066 "Cannot add to a non-extendable array");
2067 } 2067 }
2068 2068
2069 Map<int, int> asMap() {
2070 return IterableMixinWorkaround.asMapList(this);
2071 }
2072
2069 final ByteArray _array; 2073 final ByteArray _array;
2070 final int _offset; 2074 final int _offset;
2071 final int length; 2075 final int length;
2072 } 2076 }
2073 2077
2074 2078
2075 class _Int8ArrayView extends _ByteArrayViewBase implements Int8List { 2079 class _Int8ArrayView extends _ByteArrayViewBase implements Int8List {
2076 _Int8ArrayView(ByteArray array, [int offsetInBytes = 0, int _length]) 2080 _Int8ArrayView(ByteArray array, [int offsetInBytes = 0, int _length])
2077 : super(array, _requireInteger(offsetInBytes), 2081 : super(array, _requireInteger(offsetInBytes),
2078 _requireIntegerOrNull( 2082 _requireIntegerOrNull(
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
2703 ByteArray asByteArray([int start = 0, int length]) { 2707 ByteArray asByteArray([int start = 0, int length]) {
2704 if (length == null) { 2708 if (length == null) {
2705 length = this.lengthInBytes(); 2709 length = this.lengthInBytes();
2706 } 2710 }
2707 _rangeCheck(this.length, start, length); 2711 _rangeCheck(this.length, start, length);
2708 return _array.subByteArray(_offset + start, length); 2712 return _array.subByteArray(_offset + start, length);
2709 } 2713 }
2710 2714
2711 static const int _BYTES_PER_ELEMENT = 8; 2715 static const int _BYTES_PER_ELEMENT = 8;
2712 } 2716 }
OLDNEW
« no previous file with comments | « runtime/lib/array.dart ('k') | runtime/lib/growable_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698