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

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

Issue 1919143002: Store constant variable initializers in elements. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 8 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 'package:pub_semver/pub_semver.dart'; 8 import 'package:pub_semver/pub_semver.dart';
9 9
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 /// Checks if the version of lookup_map is valid, and if so, enable this 149 /// Checks if the version of lookup_map is valid, and if so, enable this
150 /// analysis during codegen. 150 /// analysis during codegen.
151 void onCodegenStart() { 151 void onCodegenStart() {
152 _inCodegen = true; 152 _inCodegen = true;
153 if (lookupMapVersionVariable == null) return; 153 if (lookupMapVersionVariable == null) return;
154 154
155 // At this point, the lookupMapVersionVariable should be resolved and it's 155 // At this point, the lookupMapVersionVariable should be resolved and it's
156 // constant value should be available. 156 // constant value should be available.
157 StringConstantValue value = 157 StringConstantValue value =
158 backend.constants.getConstantValueForVariable(lookupMapVersionVariable); 158 backend.constants.getConstantValue(lookupMapVersionVariable.constant);
159 if (value == null) { 159 if (value == null) {
160 reporter.reportInfo(lookupMapVersionVariable, 160 reporter.reportInfo(lookupMapVersionVariable,
161 MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP); 161 MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP);
162 return; 162 return;
163 } 163 }
164 164
165 // TODO(sigmund): add proper version resolution using the pub_semver package 165 // TODO(sigmund): add proper version resolution using the pub_semver package
166 // when we introduce the next version. 166 // when we introduce the next version.
167 Version version; 167 Version version;
168 try { 168 try {
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 original.fields[analysis.valueField] = keyValuePairs[1]; 429 original.fields[analysis.valueField] = keyValuePairs[1];
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 = new VersionConstraint.parse('^0.0.1'); 438 final _validLookupMapVersionConstraint = new VersionConstraint.parse('^0.0.1');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698