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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/metadata_collector.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, 7 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 /// Represents an entry's position in one of the global metadata arrays. 7 /// Represents an entry's position in one of the global metadata arrays.
8 /// 8 ///
9 /// [_rc] is used to count the number of references of the token in the 9 /// [_rc] is used to count the number of references of the token in the
10 /// ast for a program. 10 /// ast for a program.
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 206 }
207 } 207 }
208 } 208 }
209 209
210 List<jsAst.DeferredNumber> defaultValues = <jsAst.DeferredNumber>[]; 210 List<jsAst.DeferredNumber> defaultValues = <jsAst.DeferredNumber>[];
211 for (ParameterElement element in signature.optionalParameters) { 211 for (ParameterElement element in signature.optionalParameters) {
212 ParameterElement parameter = 212 ParameterElement parameter =
213 (targetParameterMap == null) ? element : targetParameterMap[element]; 213 (targetParameterMap == null) ? element : targetParameterMap[element];
214 ConstantValue constant = (parameter == null) 214 ConstantValue constant = (parameter == null)
215 ? null 215 ? null
216 : _backend.constants.getConstantValueForVariable(parameter); 216 : _backend.constants.getConstantValue(parameter.constant);
217 jsAst.Expression expression = (constant == null) 217 jsAst.Expression expression = (constant == null)
218 ? new jsAst.LiteralNull() 218 ? new jsAst.LiteralNull()
219 : _emitter.constantReference(constant); 219 : _emitter.constantReference(constant);
220 defaultValues.add(_addGlobalMetadata(expression)); 220 defaultValues.add(_addGlobalMetadata(expression));
221 } 221 }
222 return defaultValues; 222 return defaultValues;
223 } 223 }
224 224
225 Map<ParameterElement, ParameterElement> mapRedirectingFactoryConstructorOption alParameters( 225 Map<ParameterElement, ParameterElement> mapRedirectingFactoryConstructorOption alParameters(
226 FunctionSignature source, FunctionSignature target) { 226 FunctionSignature source, FunctionSignature target) {
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 if (token is _ForwardingMetadataEntry && !token.isBound) { 418 if (token is _ForwardingMetadataEntry && !token.isBound) {
419 _foundUnboundToken = true; 419 _foundUnboundToken = true;
420 } 420 }
421 } 421 }
422 422
423 bool findUnboundPlaceholders(jsAst.Node node) { 423 bool findUnboundPlaceholders(jsAst.Node node) {
424 node.accept(this); 424 node.accept(this);
425 return _foundUnboundToken; 425 return _foundUnboundToken;
426 } 426 }
427 } 427 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698