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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/compile_time_constants.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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; 5 part of dart2js;
6 6
7 /** 7 /**
8 * The [ConstantHandler] keeps track of compile-time constants, 8 * The [ConstantHandler] keeps track of compile-time constants,
9 * initializations of global and static fields, and default values of 9 * initializations of global and static fields, and default values of
10 * optional parameters. 10 * optional parameters.
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 TryCompileTimeConstantEvaluator evaluator = 214 TryCompileTimeConstantEvaluator evaluator =
215 new TryCompileTimeConstantEvaluator(this, definitions, compiler); 215 new TryCompileTimeConstantEvaluator(this, definitions, compiler);
216 return evaluator.evaluate(node); 216 return evaluator.evaluate(node);
217 } on CompileTimeConstantError catch (exn) { 217 } on CompileTimeConstantError catch (exn) {
218 return null; 218 return null;
219 } 219 }
220 }); 220 });
221 } 221 }
222 222
223 /** 223 /**
224 * Returns a [List] of static non final fields that need to be initialized. 224 * Returns an [Iterable] of static non final fields that need to be
225 * The list must be evaluated in order since the fields might depend on each 225 * initialized. The fields list must be evaluated in order since they might
226 * other. 226 * depend on each other.
227 */ 227 */
228 List<VariableElement> getStaticNonFinalFieldsForEmission() { 228 Iterable<VariableElement> getStaticNonFinalFieldsForEmission() {
229 return initialVariableValues.keys.filter((element) { 229 return initialVariableValues.keys.where((element) {
230 return element.kind == ElementKind.FIELD 230 return element.kind == ElementKind.FIELD
231 && !element.isInstanceMember() 231 && !element.isInstanceMember()
232 && !element.modifiers.isFinal(); 232 && !element.modifiers.isFinal();
233 }); 233 });
234 } 234 }
235 235
236 /** 236 /**
237 * Returns a [List] of static const fields that need to be initialized. The 237 * Returns an [Iterable] of static const fields that need to be initialized.
238 * list must be evaluated in order since the fields might depend on each 238 * The fields must be evaluated in order since they might depend on each
239 * other. 239 * other.
240 */ 240 */
241 List<VariableElement> getStaticFinalFieldsForEmission() { 241 Iterable<VariableElement> getStaticFinalFieldsForEmission() {
242 return initialVariableValues.keys.filter((element) { 242 return initialVariableValues.keys.where((element) {
243 return element.kind == ElementKind.FIELD 243 return element.kind == ElementKind.FIELD
244 && !element.isInstanceMember() 244 && !element.isInstanceMember()
245 && element.modifiers.isFinal(); 245 && element.modifiers.isFinal();
246 }); 246 });
247 } 247 }
248 248
249 List<VariableElement> getLazilyInitializedFieldsForEmission() { 249 List<VariableElement> getLazilyInitializedFieldsForEmission() {
250 return new List<VariableElement>.from(lazyStatics); 250 return new List<VariableElement>.from(lazyStatics);
251 } 251 }
252 252
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 // Use the default value. 870 // Use the default value.
871 fieldValue = handler.compileConstant(field); 871 fieldValue = handler.compileConstant(field);
872 } 872 }
873 jsNewArguments.add(fieldValue); 873 jsNewArguments.add(fieldValue);
874 }, 874 },
875 includeBackendMembers: true, 875 includeBackendMembers: true,
876 includeSuperMembers: true); 876 includeSuperMembers: true);
877 return jsNewArguments; 877 return jsNewArguments;
878 } 878 }
879 } 879 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/code_buffer.dart ('k') | sdk/lib/_internal/compiler/implementation/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698