| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 bool containsKey(Object key) { | 85 bool containsKey(Object key) { |
| 86 if (key is! String) return false; | 86 if (key is! String) return false; |
| 87 if ('__proto__' == key) return true; | 87 if ('__proto__' == key) return true; |
| 88 return jsHasOwnProperty(_jsObject, key); | 88 return jsHasOwnProperty(_jsObject, key); |
| 89 } | 89 } |
| 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 Iterable<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 | 100 |
| 101 int get length => _map._keys.length; | 101 int get length => _map._keys.length; |
| 102 } | 102 } |
| 103 | 103 |
| 104 class GeneralConstantMap<K, V> extends ConstantMap<K, V> { | 104 class GeneralConstantMap<K, V> extends ConstantMap<K, V> { |
| 105 // This constructor is not used. The instantiation is shortcut by the | 105 // This constructor is not used. The instantiation is shortcut by the |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 Iterable<K> get keys { | 140 Iterable<K> get keys { |
| 141 return _getMap().keys; | 141 return _getMap().keys; |
| 142 } | 142 } |
| 143 | 143 |
| 144 Iterable<V> get values { | 144 Iterable<V> get values { |
| 145 return _getMap().values; | 145 return _getMap().values; |
| 146 } | 146 } |
| 147 | 147 |
| 148 int get length => _getMap().length; | 148 int get length => _getMap().length; |
| 149 } | 149 } |
| OLD | NEW |