Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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}) |
| 254 : this.isEvaluatingConstant = isConst; | 254 : this.isEvaluatingConstant = isConst == null ? false : isConst; |
|
ahe
2012/11/14 13:51:30
I prefer the fix I have in https://codereview.chro
sra1
2012/11/15 00:09:10
I will merge your fix.
| |
| 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); |
| 264 isEvaluatingConstant = oldIsEvaluatingConstant; | 264 isEvaluatingConstant = oldIsEvaluatingConstant; |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 820 // Use the default value. | 820 // Use the default value. |
| 821 fieldValue = compiler.compileConstant(field); | 821 fieldValue = compiler.compileConstant(field); |
| 822 } | 822 } |
| 823 jsNewArguments.add(fieldValue); | 823 jsNewArguments.add(fieldValue); |
| 824 }, | 824 }, |
| 825 includeBackendMembers: true, | 825 includeBackendMembers: true, |
| 826 includeSuperMembers: true); | 826 includeSuperMembers: true); |
| 827 return jsNewArguments; | 827 return jsNewArguments; |
| 828 } | 828 } |
| 829 } | 829 } |
| OLD | NEW |