Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Side by Side Diff: pkg/lookup_map/lib/lookup_map.dart

Issue 1308993008: Add version validation for LookupMap, also add unittest directly in LookupMap (take 2) (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix on top of previous CL Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart ('k') | pkg/lookup_map/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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';
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart ('k') | pkg/lookup_map/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698