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 'common/resolution.dart' show | 7 import 'common/resolution.dart' show |
8 Resolution; | 8 Resolution; |
9 import 'common/tasks.dart' show | 9 import 'common/tasks.dart' show |
10 CompilerTask; | 10 CompilerTask; |
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 String toString() => expression.toString(); | 1252 String toString() => expression.toString(); |
1253 } | 1253 } |
1254 | 1254 |
1255 /// A synthetic constant used to recover from errors. | 1255 /// A synthetic constant used to recover from errors. |
1256 class ErroneousAstConstant extends AstConstant { | 1256 class ErroneousAstConstant extends AstConstant { |
1257 ErroneousAstConstant(Element element, Node node) : super(element, node, | 1257 ErroneousAstConstant(Element element, Node node) : super(element, node, |
1258 // TODO(johnniwinther): Return a [NonConstantValue] instead. | 1258 // TODO(johnniwinther): Return a [NonConstantValue] instead. |
1259 new ErroneousConstantExpression(), new NullConstantValue()); | 1259 new ErroneousConstantExpression(), new NullConstantValue()); |
1260 } | 1260 } |
1261 | 1261 |
1262 // TODO(johnniwinther): Avoid the need for this hack. | 1262 // TODO(johnniwinther): Clean this up. |
1263 TreeElements _analyzeElementEagerly(Compiler compiler, AstElement element) { | 1263 TreeElements _analyzeElementEagerly(Compiler compiler, AstElement element) { |
1264 WorldImpact worldImpact = compiler.analyzeElement(element.declaration); | 1264 compiler.resolution.analyzeElement(element.declaration); |
1265 compiler.enqueuer.resolution.applyImpact(element.declaration, worldImpact); | |
1266 return element.resolvedAst.elements; | 1265 return element.resolvedAst.elements; |
1267 } | 1266 } |
1268 | 1267 |
1269 class _CompilerEnvironment implements Environment { | 1268 class _CompilerEnvironment implements Environment { |
1270 final Compiler compiler; | 1269 final Compiler compiler; |
1271 | 1270 |
1272 _CompilerEnvironment(this.compiler); | 1271 _CompilerEnvironment(this.compiler); |
1273 | 1272 |
1274 @override | 1273 @override |
1275 String readFromEnvironment(String name) { | 1274 String readFromEnvironment(String name) { |
1276 return compiler.fromEnvironment(name); | 1275 return compiler.fromEnvironment(name); |
1277 } | 1276 } |
1278 } | 1277 } |
OLD | NEW |