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