OLD | NEW |
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 void addLast(value) { | 216 void addLast(value) { |
217 throw new UnsupportedError( | 217 throw new UnsupportedError( |
218 "Cannot add to a non-extendable array"); | 218 "Cannot add to a non-extendable array"); |
219 } | 219 } |
220 | 220 |
221 void addAll(Collection value) { | 221 void addAll(Collection value) { |
222 throw new UnsupportedError( | 222 throw new UnsupportedError( |
223 "Cannot add to a non-extendable array"); | 223 "Cannot add to a non-extendable array"); |
224 } | 224 } |
225 | 225 |
226 void sort([Comparator compare = Comparable.compare]) { | 226 void sort([int compare(var a, var b)]) { |
| 227 if (compare == null) compare = Comparable.compare; |
227 coreSort(this, compare); | 228 coreSort(this, compare); |
228 } | 229 } |
229 | 230 |
230 int indexOf(element, [int start = 0]) { | 231 int indexOf(element, [int start = 0]) { |
231 return Arrays.indexOf(this, element, start, this.length); | 232 return Arrays.indexOf(this, element, start, this.length); |
232 } | 233 } |
233 | 234 |
234 int lastIndexOf(element, [int start = null]) { | 235 int lastIndexOf(element, [int start = null]) { |
235 if (start == null) start = length - 1; | 236 if (start == null) start = length - 1; |
236 return Arrays.lastIndexOf(this, element, start); | 237 return Arrays.lastIndexOf(this, element, start); |
(...skipping 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1760 void addLast(value) { | 1761 void addLast(value) { |
1761 throw new UnsupportedError( | 1762 throw new UnsupportedError( |
1762 "Cannot add to a non-extendable array"); | 1763 "Cannot add to a non-extendable array"); |
1763 } | 1764 } |
1764 | 1765 |
1765 void addAll(Collection value) { | 1766 void addAll(Collection value) { |
1766 throw new UnsupportedError( | 1767 throw new UnsupportedError( |
1767 "Cannot add to a non-extendable array"); | 1768 "Cannot add to a non-extendable array"); |
1768 } | 1769 } |
1769 | 1770 |
1770 void sort([Comparator compare = Comparable.compare]) { | 1771 void sort([int compare(var a, var b)]) { |
| 1772 if (compare == null) compare = Comparable.compare; |
1771 coreSort(this, compare); | 1773 coreSort(this, compare); |
1772 } | 1774 } |
1773 | 1775 |
1774 int indexOf(element, [int start = 0]) { | 1776 int indexOf(element, [int start = 0]) { |
1775 return Arrays.indexOf(this, element, start, this.length); | 1777 return Arrays.indexOf(this, element, start, this.length); |
1776 } | 1778 } |
1777 | 1779 |
1778 int lastIndexOf(element, [int start = null]) { | 1780 int lastIndexOf(element, [int start = null]) { |
1779 if (start == null) start = length - 1; | 1781 if (start == null) start = length - 1; |
1780 return Arrays.lastIndexOf(this, element, start); | 1782 return Arrays.lastIndexOf(this, element, start); |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2521 } | 2523 } |
2522 _rangeCheck(this.length, start, length); | 2524 _rangeCheck(this.length, start, length); |
2523 return _array.subByteArray(_offset + start, length); | 2525 return _array.subByteArray(_offset + start, length); |
2524 } | 2526 } |
2525 | 2527 |
2526 static const int _BYTES_PER_ELEMENT = 8; | 2528 static const int _BYTES_PER_ELEMENT = 8; |
2527 final ByteArray _array; | 2529 final ByteArray _array; |
2528 final int _offset; | 2530 final int _offset; |
2529 final int _length; | 2531 final int _length; |
2530 } | 2532 } |
OLD | NEW |