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

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

Issue 11293244: Implement --analyze-all option. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 assert(!isConst); 151 assert(!isConst);
152 lazyStatics.add(element); 152 lazyStatics.add(element);
153 } 153 }
154 pendingVariables.remove(element); 154 pendingVariables.remove(element);
155 return value; 155 return value;
156 }); 156 });
157 } 157 }
158 158
159 Constant compileNodeWithDefinitions(Node node, 159 Constant compileNodeWithDefinitions(Node node,
160 TreeElements definitions, 160 TreeElements definitions,
161 {bool isConst}) { 161 {bool isConst: false}) {
162 return measure(() { 162 return measure(() {
163 assert(node != null); 163 assert(node != null);
164 CompileTimeConstantEvaluator evaluator = new CompileTimeConstantEvaluator( 164 CompileTimeConstantEvaluator evaluator = new CompileTimeConstantEvaluator(
165 constantSystem, definitions, compiler, isConst: isConst); 165 constantSystem, definitions, compiler, isConst: isConst);
166 return evaluator.evaluate(node); 166 return evaluator.evaluate(node);
167 }); 167 });
168 } 168 }
169 169
170 /** Attempts to compile a constant expression. Returns null if not possible */ 170 /** Attempts to compile a constant expression. Returns null if not possible */
171 Constant tryCompileNodeWithDefinitions(Node node, TreeElements definitions) { 171 Constant tryCompileNodeWithDefinitions(Node node, TreeElements definitions) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 243
244 class CompileTimeConstantEvaluator extends Visitor { 244 class CompileTimeConstantEvaluator extends Visitor {
245 bool isEvaluatingConstant; 245 bool isEvaluatingConstant;
246 final ConstantSystem constantSystem; 246 final ConstantSystem constantSystem;
247 final TreeElements elements; 247 final TreeElements elements;
248 final Compiler compiler; 248 final Compiler compiler;
249 249
250 CompileTimeConstantEvaluator(this.constantSystem, 250 CompileTimeConstantEvaluator(this.constantSystem,
251 this.elements, 251 this.elements,
252 this.compiler, 252 this.compiler,
253 {bool isConst}) 253 {bool isConst: false})
254 : this.isEvaluatingConstant = isConst; 254 : this.isEvaluatingConstant = isConst;
255 255
256 Constant evaluate(Node node) { 256 Constant evaluate(Node node) {
257 return node.accept(this); 257 return node.accept(this);
258 } 258 }
259 259
260 Constant evaluateConstant(Node node) { 260 Constant evaluateConstant(Node node) {
261 bool oldIsEvaluatingConstant = isEvaluatingConstant; 261 bool oldIsEvaluatingConstant = isEvaluatingConstant;
262 isEvaluatingConstant = true; 262 isEvaluatingConstant = true;
263 Constant result = node.accept(this); 263 Constant result = node.accept(this);
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 // Use the default value. 809 // Use the default value.
810 fieldValue = compiler.compileConstant(field); 810 fieldValue = compiler.compileConstant(field);
811 } 811 }
812 jsNewArguments.add(fieldValue); 812 jsNewArguments.add(fieldValue);
813 }, 813 },
814 includeBackendMembers: true, 814 includeBackendMembers: true,
815 includeSuperMembers: true); 815 includeSuperMembers: true);
816 return jsNewArguments; 816 return jsNewArguments;
817 } 817 }
818 } 818 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698