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

Side by Side Diff: pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart

Issue 1383503002: Add Resolution and Parsing interfaces for computeType, ensureResolved and parseNode. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Add TODOs. Created 5 years, 2 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
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 /// Analysis to determine how to generate code for `LookupMap`s. 5 /// Analysis to determine how to generate code for `LookupMap`s.
6 library compiler.src.js_backend.lookup_map_analysis; 6 library compiler.src.js_backend.lookup_map_analysis;
7 7
8 import '../common/registry.dart' show Registry; 8 import '../common/registry.dart' show Registry;
9 import '../compiler.dart' show Compiler; 9 import '../compiler.dart' show Compiler;
10 import '../diagnostics/messages.dart' show MessageKind; 10 import '../diagnostics/messages.dart' show MessageKind;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 version = new Version.parse(value.primitiveValue.slowToString()); 167 version = new Version.parse(value.primitiveValue.slowToString());
168 } catch (e) {} 168 } catch (e) {}
169 169
170 if (version == null || !_validLookupMapVersionConstraint.allows(version)) { 170 if (version == null || !_validLookupMapVersionConstraint.allows(version)) {
171 backend.compiler.reportInfo(lookupMapVersionVariable, 171 backend.compiler.reportInfo(lookupMapVersionVariable,
172 MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP); 172 MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP);
173 return; 173 return;
174 } 174 }
175 175
176 ClassElement cls = lookupMapLibrary.findLocal('LookupMap'); 176 ClassElement cls = lookupMapLibrary.findLocal('LookupMap');
177 cls.computeType(backend.compiler); 177 cls.computeType(backend.resolution);
178 entriesField = cls.lookupMember('_entries'); 178 entriesField = cls.lookupMember('_entries');
179 keyField = cls.lookupMember('_key'); 179 keyField = cls.lookupMember('_key');
180 valueField = cls.lookupMember('_value'); 180 valueField = cls.lookupMember('_value');
181 // TODO(sigmund): Maybe inline nested maps to make the output code smaller? 181 // TODO(sigmund): Maybe inline nested maps to make the output code smaller?
182 typeLookupMapClass = cls; 182 typeLookupMapClass = cls;
183 } 183 }
184 184
185 /// Whether [constant] is an instance of a `LookupMap`. 185 /// Whether [constant] is an instance of a `LookupMap`.
186 bool isLookupMap(ConstantValue constant) => 186 bool isLookupMap(ConstantValue constant) =>
187 _isEnabled && 187 _isEnabled &&
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 } 430 }
431 } else { 431 } else {
432 original.fields[analysis.entriesField] = 432 original.fields[analysis.entriesField] =
433 new ListConstantValue(listType, keyValuePairs); 433 new ListConstantValue(listType, keyValuePairs);
434 } 434 }
435 } 435 }
436 } 436 }
437 437
438 final _validLookupMapVersionConstraint = 438 final _validLookupMapVersionConstraint =
439 new VersionConstraint.parse('^0.0.1'); 439 new VersionConstraint.parse('^0.0.1');
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/js_backend.dart ('k') | pkg/compiler/lib/src/js_backend/patch_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698