OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 file for dart:collection classes. | 5 // Patch file for dart:collection classes. |
6 import 'dart:_foreign_helper' show JS; | 6 import 'dart:_foreign_helper' show JS; |
7 import 'dart:_js_helper' show | 7 import 'dart:_js_helper' show |
8 fillLiteralMap, InternalMap, NoInline, NoThrows, patch, JsLinkedHashMap, | 8 fillLiteralMap, InternalMap, NoInline, NoThrows, patch, JsLinkedHashMap, |
9 LinkedHashMapCell, LinkedHashMapKeyIterable, LinkedHashMapKeyIterator; | 9 LinkedHashMapCell, LinkedHashMapKeyIterable, LinkedHashMapKeyIterator; |
10 | 10 |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 int length = JS('int', '#.length', bucket); | 420 int length = JS('int', '#.length', bucket); |
421 for (int i = 0; i < length; i += 2) { | 421 for (int i = 0; i < length; i += 2) { |
422 if (_equals(JS('var', '#[#]', bucket, i), key)) return i; | 422 if (_equals(JS('var', '#[#]', bucket, i), key)) return i; |
423 } | 423 } |
424 return -1; | 424 return -1; |
425 } | 425 } |
426 | 426 |
427 String toString() => Maps.mapToString(this); | 427 String toString() => Maps.mapToString(this); |
428 } | 428 } |
429 | 429 |
430 class HashMapKeyIterable<E> extends IterableBase<E> | 430 class HashMapKeyIterable<E> extends Iterable<E> |
431 implements EfficientLength { | 431 implements EfficientLength { |
432 final _map; | 432 final _map; |
433 HashMapKeyIterable(this._map); | 433 HashMapKeyIterable(this._map); |
434 | 434 |
435 int get length => _map._length; | 435 int get length => _map._length; |
436 bool get isEmpty => _map._length == 0; | 436 bool get isEmpty => _map._length == 0; |
437 | 437 |
438 Iterator<E> get iterator { | 438 Iterator<E> get iterator { |
439 return new HashMapKeyIterator<E>(_map, _map._computeKeys()); | 439 return new HashMapKeyIterator<E>(_map, _map._computeKeys()); |
440 } | 440 } |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 } else if (_cell == null) { | 1458 } else if (_cell == null) { |
1459 _current = null; | 1459 _current = null; |
1460 return false; | 1460 return false; |
1461 } else { | 1461 } else { |
1462 _current = _cell._element; | 1462 _current = _cell._element; |
1463 _cell = _cell._next; | 1463 _cell = _cell._next; |
1464 return true; | 1464 return true; |
1465 } | 1465 } |
1466 } | 1466 } |
1467 } | 1467 } |
OLD | NEW |