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

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

Issue 11316059: Add List.first. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add dart2js interceptor and add test. Created 8 years, 1 month 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.view(ByteArray array, 10 /* patch */ factory Int8List.view(ByteArray array,
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 void clear() { 199 void clear() {
200 throw new UnsupportedError( 200 throw new UnsupportedError(
201 "Cannot remove from a non-extendable array"); 201 "Cannot remove from a non-extendable array");
202 } 202 }
203 203
204 int removeLast() { 204 int removeLast() {
205 throw new UnsupportedError( 205 throw new UnsupportedError(
206 "Cannot remove from a non-extendable array"); 206 "Cannot remove from a non-extendable array");
207 } 207 }
208 208
209 get first {
210 return this[0];
211 }
212
209 get last { 213 get last {
210 return this[length - 1]; 214 return this[length - 1];
211 } 215 }
212 216
213 void removeRange(int start, int length) { 217 void removeRange(int start, int length) {
214 throw new UnsupportedError( 218 throw new UnsupportedError(
215 "Cannot remove from a non-extendable array"); 219 "Cannot remove from a non-extendable array");
216 } 220 }
217 221
218 void insertRange(int start, int length, [initialValue]) { 222 void insertRange(int start, int length, [initialValue]) {
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 void clear() { 1681 void clear() {
1678 throw new UnsupportedError( 1682 throw new UnsupportedError(
1679 "Cannot remove from a non-extendable array"); 1683 "Cannot remove from a non-extendable array");
1680 } 1684 }
1681 1685
1682 int removeLast() { 1686 int removeLast() {
1683 throw new UnsupportedError( 1687 throw new UnsupportedError(
1684 "Cannot remove from a non-extendable array"); 1688 "Cannot remove from a non-extendable array");
1685 } 1689 }
1686 1690
1691 get first {
1692 return this[0];
1693 }
1694
1687 get last { 1695 get last {
1688 return this[length - 1]; 1696 return this[length - 1];
1689 } 1697 }
1690 1698
1691 void removeRange(int start, int length) { 1699 void removeRange(int start, int length) {
1692 throw new UnsupportedError( 1700 throw new UnsupportedError(
1693 "Cannot remove from a non-extendable array"); 1701 "Cannot remove from a non-extendable array");
1694 } 1702 }
1695 1703
1696 void insertRange(int start, int length, [initialValue]) { 1704 void insertRange(int start, int length, [initialValue]) {
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 } 2419 }
2412 _rangeCheck(this.length, start, length); 2420 _rangeCheck(this.length, start, length);
2413 return _array.subByteArray(_offset + start, length); 2421 return _array.subByteArray(_offset + start, length);
2414 } 2422 }
2415 2423
2416 static const int _BYTES_PER_ELEMENT = 8; 2424 static const int _BYTES_PER_ELEMENT = 8;
2417 final ByteArray _array; 2425 final ByteArray _array;
2418 final int _offset; 2426 final int _offset;
2419 final int _length; 2427 final int _length;
2420 } 2428 }
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