| 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 part of _js_helper; | 5 part of _js_helper; |
| 6 | 6 |
| 7 abstract class ConstantMap<K, V> implements Map<K, V> { | 7 abstract class ConstantMap<K, V> implements Map<K, V> { |
| 8 const ConstantMap._(); | 8 const ConstantMap._(); |
| 9 | 9 |
| 10 bool get isEmpty => length == 0; | 10 bool get isEmpty => length == 0; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 _fetch(key) => | 91 _fetch(key) => |
| 92 '__proto__' == key ? _protoValue : jsPropertyAccess(_jsObject, key); | 92 '__proto__' == key ? _protoValue : jsPropertyAccess(_jsObject, key); |
| 93 } | 93 } |
| 94 | 94 |
| 95 class _ConstantMapKeyIterable<K> extends IterableBase<K> { | 95 class _ConstantMapKeyIterable<K> extends IterableBase<K> { |
| 96 ConstantStringMap<K, dynamic> _map; | 96 ConstantStringMap<K, dynamic> _map; |
| 97 _ConstantMapKeyIterable(this._map); | 97 _ConstantMapKeyIterable(this._map); |
| 98 | 98 |
| 99 Iterator<K> get iterator => _map._keys.iterator; | 99 Iterator<K> get iterator => _map._keys.iterator; |
| 100 |
| 101 int get length => _map._keys.length; |
| 100 } | 102 } |
| 101 | 103 |
| 102 class GeneralConstantMap<K, V> extends ConstantMap<K, V> { | 104 class GeneralConstantMap<K, V> extends ConstantMap<K, V> { |
| 103 // This constructor is not used. The instantiation is shortcut by the | 105 // This constructor is not used. The instantiation is shortcut by the |
| 104 // compiler. It is here to make the uninitialized final fields legal. | 106 // compiler. It is here to make the uninitialized final fields legal. |
| 105 GeneralConstantMap(this._jsData) : super._(); | 107 GeneralConstantMap(this._jsData) : super._(); |
| 106 | 108 |
| 107 // [_jsData] holds a key-value pair list. | 109 // [_jsData] holds a key-value pair list. |
| 108 final _jsData; | 110 final _jsData; |
| 109 | 111 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 136 Iterable<K> get keys { | 138 Iterable<K> get keys { |
| 137 return _getMap().keys; | 139 return _getMap().keys; |
| 138 } | 140 } |
| 139 | 141 |
| 140 Iterable<V> get values { | 142 Iterable<V> get values { |
| 141 return _getMap().values; | 143 return _getMap().values; |
| 142 } | 144 } |
| 143 | 145 |
| 144 int get length => _getMap().length; | 146 int get length => _getMap().length; |
| 145 } | 147 } |
| OLD | NEW |