| 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 library dart2js.compile_time_constant_evaluator; | 5 library dart2js.compile_time_constant_evaluator; |
| 6 | 6 |
| 7 import 'constant_system_dart.dart'; | 7 import 'constant_system_dart.dart'; |
| 8 import 'constants/constant_system.dart'; | 8 import 'constants/constant_system.dart'; |
| 9 import 'constants/expressions.dart'; | 9 import 'constants/expressions.dart'; |
| 10 import 'constants/values.dart'; | 10 import 'constants/values.dart'; |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 329 |
| 330 CompileTimeConstantEvaluator(this.handler, | 330 CompileTimeConstantEvaluator(this.handler, |
| 331 this.elements, | 331 this.elements, |
| 332 this.compiler, | 332 this.compiler, |
| 333 {bool isConst: false}) | 333 {bool isConst: false}) |
| 334 : this.isEvaluatingConstant = isConst; | 334 : this.isEvaluatingConstant = isConst; |
| 335 | 335 |
| 336 ConstantSystem get constantSystem => handler.constantSystem; | 336 ConstantSystem get constantSystem => handler.constantSystem; |
| 337 | 337 |
| 338 AstConstant evaluate(Node node) { | 338 AstConstant evaluate(Node node) { |
| 339 // TODO(johnniwinter): should there be a visitErrorNode? | 339 // TODO(johnniwinther): should there be a visitErrorNode? |
| 340 if (node is ErrorNode) return new ErroneousAstConstant(context, node); | 340 if (node is ErrorNode) return new ErroneousAstConstant(context, node); |
| 341 return node.accept(this); | 341 return node.accept(this); |
| 342 } | 342 } |
| 343 | 343 |
| 344 AstConstant evaluateConstant(Node node) { | 344 AstConstant evaluateConstant(Node node) { |
| 345 bool oldIsEvaluatingConstant = isEvaluatingConstant; | 345 bool oldIsEvaluatingConstant = isEvaluatingConstant; |
| 346 isEvaluatingConstant = true; | 346 isEvaluatingConstant = true; |
| 347 AstConstant result = node.accept(this); | 347 AstConstant result = node.accept(this); |
| 348 isEvaluatingConstant = oldIsEvaluatingConstant; | 348 isEvaluatingConstant = oldIsEvaluatingConstant; |
| 349 assert(result != null); | 349 assert(result != null); |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 // TODO(johnniwinther): Return a [NonConstantValue] instead. | 1335 // TODO(johnniwinther): Return a [NonConstantValue] instead. |
| 1336 new ErroneousConstantExpression(), new NullConstantValue()); | 1336 new ErroneousConstantExpression(), new NullConstantValue()); |
| 1337 } | 1337 } |
| 1338 | 1338 |
| 1339 // TODO(johnniwinther): Avoid the need for this hack. | 1339 // TODO(johnniwinther): Avoid the need for this hack. |
| 1340 TreeElements _analyzeElementEagerly(Compiler compiler, AstElement element) { | 1340 TreeElements _analyzeElementEagerly(Compiler compiler, AstElement element) { |
| 1341 WorldImpact worldImpact = compiler.analyzeElement(element.declaration); | 1341 WorldImpact worldImpact = compiler.analyzeElement(element.declaration); |
| 1342 compiler.enqueuer.resolution.applyImpact(element.declaration, worldImpact); | 1342 compiler.enqueuer.resolution.applyImpact(element.declaration, worldImpact); |
| 1343 return element.resolvedAst.elements; | 1343 return element.resolvedAst.elements; |
| 1344 } | 1344 } |
| OLD | NEW |