| Index: runtime/lib/byte_array.dart
|
| diff --git a/runtime/lib/byte_array.dart b/runtime/lib/byte_array.dart
|
| index 882dd7c77700aca11e185868e343f239a7022075..38c262eec0991105cecb3f8c7c0ed5277f72aaa5 100644
|
| --- a/runtime/lib/byte_array.dart
|
| +++ b/runtime/lib/byte_array.dart
|
| @@ -358,7 +358,7 @@ class _Int8Array extends _ByteArrayBase implements Int8List {
|
| _setIndexed(index, _toInt8(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -421,7 +421,7 @@ class _Uint8Array extends _ByteArrayBase implements Uint8List {
|
| _setIndexed(index, _toUint8(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -484,7 +484,7 @@ class _Int16Array extends _ByteArrayBase implements Int16List {
|
| _setIndexed(index, _toInt16(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -547,7 +547,7 @@ class _Uint16Array extends _ByteArrayBase implements Uint16List {
|
| _setIndexed(index, _toUint16(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -610,7 +610,7 @@ class _Int32Array extends _ByteArrayBase implements Int32List {
|
| _setIndexed(index, _toInt32(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -673,7 +673,7 @@ class _Uint32Array extends _ByteArrayBase implements Uint32List {
|
| _setIndexed(index, _toUint32(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -736,7 +736,7 @@ class _Int64Array extends _ByteArrayBase implements Int64List {
|
| _setIndexed(index, _toInt64(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -799,7 +799,7 @@ class _Uint64Array extends _ByteArrayBase implements Uint64List {
|
| _setIndexed(index, _toUint64(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -862,7 +862,7 @@ class _Float32Array extends _ByteArrayBase implements Float32List {
|
| _setIndexed(index, value);
|
| }
|
|
|
| - Iterator<double> iterator() {
|
| + Iterator<double> get iterator {
|
| return new _ByteArrayIterator<double>(this);
|
| }
|
|
|
| @@ -925,7 +925,7 @@ class _Float64Array extends _ByteArrayBase implements Float64List {
|
| _setIndexed(index, value);
|
| }
|
|
|
| - Iterator<double> iterator() {
|
| + Iterator<double> get iterator {
|
| return new _ByteArrayIterator<double>(this);
|
| }
|
|
|
| @@ -977,7 +977,7 @@ class _ExternalInt8Array extends _ByteArrayBase implements Int8List {
|
| _setIndexed(index, _toInt8(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -1027,7 +1027,7 @@ class _ExternalUint8Array extends _ByteArrayBase implements Uint8List {
|
| _setIndexed(index, _toUint8(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -1077,7 +1077,7 @@ class _ExternalInt16Array extends _ByteArrayBase implements Int16List {
|
| _setIndexed(index, _toInt16(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -1127,7 +1127,7 @@ class _ExternalUint16Array extends _ByteArrayBase implements Uint16List {
|
| _setIndexed(index, _toUint16(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -1179,7 +1179,7 @@ class _ExternalInt32Array extends _ByteArrayBase implements Int32List {
|
| _setIndexed(index, _toInt32(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -1231,7 +1231,7 @@ class _ExternalUint32Array extends _ByteArrayBase implements Uint32List {
|
| _setIndexed(index, _toUint32(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -1283,7 +1283,7 @@ class _ExternalInt64Array extends _ByteArrayBase implements Int64List {
|
| _setIndexed(index, _toInt64(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -1335,7 +1335,7 @@ class _ExternalUint64Array extends _ByteArrayBase implements Uint64List {
|
| _setIndexed(index, _toUint64(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -1387,7 +1387,7 @@ class _ExternalFloat32Array extends _ByteArrayBase implements Float32List {
|
| _setIndexed(index, value);
|
| }
|
|
|
| - Iterator<double> iterator() {
|
| + Iterator<double> get iterator {
|
| return new _ByteArrayIterator<double>(this);
|
| }
|
|
|
| @@ -1439,7 +1439,7 @@ class _ExternalFloat64Array extends _ByteArrayBase implements Float64List {
|
| _setIndexed(index, value);
|
| }
|
|
|
| - Iterator<double> iterator() {
|
| + Iterator<double> get iterator {
|
| return new _ByteArrayIterator<double>(this);
|
| }
|
|
|
| @@ -1484,19 +1484,23 @@ class _ExternalFloat64Array extends _ByteArrayBase implements Float64List {
|
|
|
| class _ByteArrayIterator<E> implements Iterator<E> {
|
| _ByteArrayIterator(List array)
|
| - : _array = array, _length = array.length, _pos = 0 {
|
| + : _array = array, _length = array.length, _pos = -1 {
|
| assert(array is _ByteArrayBase || array is _ByteArrayViewBase);
|
| }
|
|
|
| - bool get hasNext {
|
| - return _length > _pos;
|
| + bool moveNext() {
|
| + _pos++;
|
| + if (_pos < _length) return true;
|
| + _pos = _length;
|
| + return false;
|
| }
|
|
|
| - E next() {
|
| - if (!hasNext) {
|
| - throw new StateError("No more elements");
|
| + E get current {
|
| + if (0 <= _pos && _pos < _length) {
|
| + return _array[_pos];
|
| }
|
| - return _array[_pos++];
|
| + // TODO(floitsch): adapt error message.
|
| + throw new StateError("No more elements");
|
| }
|
|
|
| final List<E> _array;
|
| @@ -1730,7 +1734,7 @@ class _Int8ArrayView extends _ByteArrayViewBase implements Int8List {
|
| _array.setInt8(_offset + (index * _BYTES_PER_ELEMENT), _toInt8(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -1802,7 +1806,7 @@ class _Uint8ArrayView extends _ByteArrayViewBase implements Uint8List {
|
| _array.setUint8(_offset + (index * _BYTES_PER_ELEMENT), _toUint8(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -1874,7 +1878,7 @@ class _Int16ArrayView extends _ByteArrayViewBase implements Int16List {
|
| _array.setInt16(_offset + (index * _BYTES_PER_ELEMENT), _toInt16(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -1946,7 +1950,7 @@ class _Uint16ArrayView extends _ByteArrayViewBase implements Uint16List {
|
| _array.setUint16(_offset + (index * _BYTES_PER_ELEMENT), _toUint16(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -2018,7 +2022,7 @@ class _Int32ArrayView extends _ByteArrayViewBase implements Int32List {
|
| _array.setInt32(_offset + (index * _BYTES_PER_ELEMENT), _toInt32(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -2090,7 +2094,7 @@ class _Uint32ArrayView extends _ByteArrayViewBase implements Uint32List {
|
| _array.setUint32(_offset + (index * _BYTES_PER_ELEMENT), _toUint32(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -2162,7 +2166,7 @@ class _Int64ArrayView extends _ByteArrayViewBase implements Int64List {
|
| _array.setInt64(_offset + (index * _BYTES_PER_ELEMENT), _toInt64(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -2234,7 +2238,7 @@ class _Uint64ArrayView extends _ByteArrayViewBase implements Uint64List {
|
| _array.setUint64(_offset + (index * _BYTES_PER_ELEMENT), _toUint64(value));
|
| }
|
|
|
| - Iterator<int> iterator() {
|
| + Iterator<int> get iterator {
|
| return new _ByteArrayIterator<int>(this);
|
| }
|
|
|
| @@ -2306,7 +2310,7 @@ class _Float32ArrayView extends _ByteArrayViewBase implements Float32List {
|
| _array.setFloat32(_offset + (index * _BYTES_PER_ELEMENT), value);
|
| }
|
|
|
| - Iterator<double> iterator() {
|
| + Iterator<double> get iterator {
|
| return new _ByteArrayIterator<double>(this);
|
| }
|
|
|
| @@ -2378,7 +2382,7 @@ class _Float64ArrayView extends _ByteArrayViewBase implements Float64List {
|
| _array.setFloat64(_offset + (index * _BYTES_PER_ELEMENT), value);
|
| }
|
|
|
| - Iterator<double> iterator() {
|
| + Iterator<double> get iterator {
|
| return new _ByteArrayIterator<double>(this);
|
| }
|
|
|
|
|