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.common.codegen; | 5 library dart2js.common.codegen; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
9 import '../constants/values.dart' show ConstantValue; | 9 import '../constants/values.dart' show ConstantValue; |
10 import '../dart_types.dart' show DartType, InterfaceType; | 10 import '../dart_types.dart' show DartType, InterfaceType; |
11 import '../elements/elements.dart' | 11 import '../elements/elements.dart' |
12 show | 12 show |
13 AstElement, | 13 AstElement, |
14 ClassElement, | 14 ClassElement, |
15 Element, | 15 Element, |
16 FunctionElement, | 16 FunctionElement, |
17 LocalFunctionElement; | 17 LocalFunctionElement, |
| 18 ResolvedAst; |
18 import '../enqueue.dart' show CodegenEnqueuer; | 19 import '../enqueue.dart' show CodegenEnqueuer; |
19 import '../resolution/tree_elements.dart' show TreeElements; | |
20 import '../universe/use.dart' show DynamicUse, StaticUse, TypeUse; | 20 import '../universe/use.dart' show DynamicUse, StaticUse, TypeUse; |
21 import '../universe/world_impact.dart' | 21 import '../universe/world_impact.dart' |
22 show WorldImpact, WorldImpactBuilder, WorldImpactVisitor; | 22 show WorldImpact, WorldImpactBuilder, WorldImpactVisitor; |
23 import '../util/util.dart' show Pair, Setlet; | 23 import '../util/util.dart' show Pair, Setlet; |
24 import 'registry.dart' show Registry, EagerRegistry; | 24 import 'registry.dart' show Registry, EagerRegistry; |
25 import 'work.dart' show ItemCompilationContext, WorkItem; | 25 import 'work.dart' show ItemCompilationContext, WorkItem; |
26 | 26 |
27 class CodegenImpact extends WorldImpact { | 27 class CodegenImpact extends WorldImpact { |
28 const CodegenImpact(); | 28 const CodegenImpact(); |
29 | 29 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 228 |
229 factory CodegenWorkItem(Compiler compiler, AstElement element, | 229 factory CodegenWorkItem(Compiler compiler, AstElement element, |
230 ItemCompilationContext compilationContext) { | 230 ItemCompilationContext compilationContext) { |
231 // If this assertion fails, the resolution callbacks of the backend may be | 231 // If this assertion fails, the resolution callbacks of the backend may be |
232 // missing call of form registry.registerXXX. Alternatively, the code | 232 // missing call of form registry.registerXXX. Alternatively, the code |
233 // generation could spuriously be adding dependencies on things we know we | 233 // generation could spuriously be adding dependencies on things we know we |
234 // don't need. | 234 // don't need. |
235 assert(invariant( | 235 assert(invariant( |
236 element, compiler.enqueuer.resolution.hasBeenProcessed(element), | 236 element, compiler.enqueuer.resolution.hasBeenProcessed(element), |
237 message: "$element has not been resolved.")); | 237 message: "$element has not been resolved.")); |
238 assert(invariant(element, element.resolvedAst.elements != null, | 238 assert(invariant(element, element.hasResolvedAst, |
239 message: 'Resolution tree is null for $element in codegen work item')); | 239 message: 'Resolution tree is null for $element in codegen work item')); |
240 return new CodegenWorkItem.internal(element, compilationContext); | 240 return new CodegenWorkItem.internal(element, compilationContext); |
241 } | 241 } |
242 | 242 |
243 CodegenWorkItem.internal( | 243 CodegenWorkItem.internal( |
244 AstElement element, ItemCompilationContext compilationContext) | 244 AstElement element, ItemCompilationContext compilationContext) |
245 : super(element, compilationContext); | 245 : super(element, compilationContext); |
246 | 246 |
247 TreeElements get resolutionTree => element.resolvedAst.elements; | 247 ResolvedAst get resolvedAst => element.resolvedAst; |
248 | 248 |
249 WorldImpact run(Compiler compiler, CodegenEnqueuer world) { | 249 WorldImpact run(Compiler compiler, CodegenEnqueuer world) { |
250 if (world.isProcessed(element)) return const WorldImpact(); | 250 if (world.isProcessed(element)) return const WorldImpact(); |
251 | 251 |
252 registry = new CodegenRegistry(compiler, element); | 252 registry = new CodegenRegistry(compiler, element); |
253 return compiler.codegen(this, world); | 253 return compiler.codegen(this, world); |
254 } | 254 } |
255 } | 255 } |
OLD | NEW |