OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // Efficient JavaScript based implementation of a linked hash map used as a | 5 // Efficient JavaScript based implementation of a linked hash map used as a |
6 // backing map for constant maps and the [LinkedHashMap] patch | 6 // backing map for constant maps and the [LinkedHashMap] patch |
7 | 7 |
8 part of _js_helper; | 8 part of _js_helper; |
9 | 9 |
10 const _USE_ES6_MAPS = const bool.fromEnvironment("dart2js.use.es6.maps"); | 10 const _USE_ES6_MAPS = const bool.fromEnvironment("dart2js.use.es6.maps"); |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 final hashMapCellKey; | 363 final hashMapCellKey; |
364 var hashMapCellValue; | 364 var hashMapCellValue; |
365 | 365 |
366 LinkedHashMapCell _next; | 366 LinkedHashMapCell _next; |
367 LinkedHashMapCell _previous; | 367 LinkedHashMapCell _previous; |
368 | 368 |
369 LinkedHashMapCell(this.hashMapCellKey, this.hashMapCellValue); | 369 LinkedHashMapCell(this.hashMapCellKey, this.hashMapCellValue); |
370 } | 370 } |
371 | 371 |
372 class LinkedHashMapKeyIterable<E> extends Iterable<E> | 372 class LinkedHashMapKeyIterable<E> extends Iterable<E> |
373 implements EfficientLengthIterable<E> { | 373 implements EfficientLength { |
374 final _map; | 374 final _map; |
375 LinkedHashMapKeyIterable(this._map); | 375 LinkedHashMapKeyIterable(this._map); |
376 | 376 |
377 int get length => _map._length; | 377 int get length => _map._length; |
378 bool get isEmpty => _map._length == 0; | 378 bool get isEmpty => _map._length == 0; |
379 | 379 |
380 Iterator<E> get iterator { | 380 Iterator<E> get iterator { |
381 return new LinkedHashMapKeyIterator<E>(_map, _map._modifications); | 381 return new LinkedHashMapKeyIterator<E>(_map, _map._modifications); |
382 } | 382 } |
383 | 383 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 } else if (_cell == null) { | 416 } else if (_cell == null) { |
417 _current = null; | 417 _current = null; |
418 return false; | 418 return false; |
419 } else { | 419 } else { |
420 _current = _cell.hashMapCellKey; | 420 _current = _cell.hashMapCellKey; |
421 _cell = _cell._next; | 421 _cell = _cell._next; |
422 return true; | 422 return true; |
423 } | 423 } |
424 } | 424 } |
425 } | 425 } |
OLD | NEW |