OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// Defines [LookupMap], a simple map that can be optimized by dart2js. | 5 /// Defines [LookupMap], a simple map that can be optimized by dart2js. |
6 library lookup_map; | 6 library lookup_map; |
7 | 7 |
8 /// [LookupMap] is a simple, but very restricted map. The map can only hold | 8 /// [LookupMap] is a simple, but very restricted map. The map can only hold |
9 /// constant keys and the only way to use the map is to retrieve values with a | 9 /// constant keys and the only way to use the map is to retrieve values with a |
10 /// key you already have. Expect for lookup, any other operation in [Map] (like | 10 /// key you already have. Expect for lookup, any other operation in [Map] (like |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 for (var i = 0; i < _entries.length; i += 2) { | 84 for (var i = 0; i < _entries.length; i += 2) { |
85 map[_entries[i]] = _entries[i + 1]; | 85 map[_entries[i]] = _entries[i + 1]; |
86 } | 86 } |
87 if (_key != null) map[_key] = _value; | 87 if (_key != null) map[_key] = _value; |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 /// An expando that stores a flatten version of a [LookupMap], this is | 91 /// An expando that stores a flatten version of a [LookupMap], this is |
92 /// computed and stored the first time the map is accessed. | 92 /// computed and stored the first time the map is accessed. |
93 final _flatMap = new Expando('_flat_map'); | 93 final _flatMap = new Expando('_flat_map'); |
| 94 |
| 95 /// Internal constant that matches the version in the pubspec. This is used by |
| 96 /// dart2js to ensure that optimizations are only enabled on known versions of |
| 97 /// this code. |
| 98 // Note: this needs to be kept in sync with the pubspec, otherwise |
| 99 // test/version_check_test would fail. |
| 100 final _version = '0.0.1'; |
OLD | NEW |