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

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

Issue 11230011: Make hasNext a getter instead of a method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove unused variable. Created 8 years, 2 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 | « pkg/unittest/mock.dart ('k') | runtime/lib/byte_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 5
6 // TODO(srdjan): Use shared array implementation. 6 // TODO(srdjan): Use shared array implementation.
7 class _ObjectArray<E> implements List<E> { 7 class _ObjectArray<E> implements List<E> {
8 8
9 factory _ObjectArray(int length) native "ObjectArray_allocate"; 9 factory _ObjectArray(int length) native "ObjectArray_allocate";
10 10
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 291 }
292 292
293 293
294 // Iterator for arrays with fixed size. 294 // Iterator for arrays with fixed size.
295 class _FixedSizeArrayIterator<E> implements Iterator<E> { 295 class _FixedSizeArrayIterator<E> implements Iterator<E> {
296 _FixedSizeArrayIterator(List array) 296 _FixedSizeArrayIterator(List array)
297 : _array = array, _length = array.length, _pos = 0 { 297 : _array = array, _length = array.length, _pos = 0 {
298 assert(array is _ObjectArray || array is _ImmutableArray); 298 assert(array is _ObjectArray || array is _ImmutableArray);
299 } 299 }
300 300
301 bool hasNext() { 301 bool get hasNext {
302 return _length > _pos; 302 return _length > _pos;
303 } 303 }
304 304
305 E next() { 305 E next() {
306 if (!hasNext()) { 306 if (!hasNext) {
307 throw const NoMoreElementsException(); 307 throw const NoMoreElementsException();
308 } 308 }
309 return _array[_pos++]; 309 return _array[_pos++];
310 } 310 }
311 311
312 final List<E> _array; 312 final List<E> _array;
313 final int _length; // Cache array length for faster access. 313 final int _length; // Cache array length for faster access.
314 int _pos; 314 int _pos;
315 } 315 }
OLDNEW
« no previous file with comments | « pkg/unittest/mock.dart ('k') | runtime/lib/byte_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698