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 '../compiler.dart' show | 7 import '../compiler.dart' show |
8 Compiler; | 8 Compiler; |
9 import '../constants/values.dart' show | 9 import '../constants/values.dart' show |
10 ConstantValue; | 10 ConstantValue; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 factory CodegenWorkItem( | 185 factory CodegenWorkItem( |
186 Compiler compiler, | 186 Compiler compiler, |
187 AstElement element, | 187 AstElement element, |
188 ItemCompilationContext compilationContext) { | 188 ItemCompilationContext compilationContext) { |
189 // If this assertion fails, the resolution callbacks of the backend may be | 189 // If this assertion fails, the resolution callbacks of the backend may be |
190 // missing call of form registry.registerXXX. Alternatively, the code | 190 // missing call of form registry.registerXXX. Alternatively, the code |
191 // generation could spuriously be adding dependencies on things we know we | 191 // generation could spuriously be adding dependencies on things we know we |
192 // don't need. | 192 // don't need. |
193 assert(invariant(element, | 193 assert(invariant(element, |
194 compiler.enqueuer.resolution.hasBeenProcessed(element), | 194 compiler.enqueuer.resolution.hasBeenResolved(element), |
195 message: "$element has not been resolved.")); | 195 message: "$element has not been resolved.")); |
196 assert(invariant(element, element.resolvedAst.elements != null, | 196 assert(invariant(element, element.resolvedAst.elements != null, |
197 message: 'Resolution tree is null for $element in codegen work item')); | 197 message: 'Resolution tree is null for $element in codegen work item')); |
198 return new CodegenWorkItem.internal(element, compilationContext); | 198 return new CodegenWorkItem.internal(element, compilationContext); |
199 } | 199 } |
200 | 200 |
201 CodegenWorkItem.internal( | 201 CodegenWorkItem.internal( |
202 AstElement element, | 202 AstElement element, |
203 ItemCompilationContext compilationContext) | 203 ItemCompilationContext compilationContext) |
204 : super(element, compilationContext); | 204 : super(element, compilationContext); |
205 | 205 |
206 TreeElements get resolutionTree => element.resolvedAst.elements; | 206 TreeElements get resolutionTree => element.resolvedAst.elements; |
207 | 207 |
208 WorldImpact run(Compiler compiler, CodegenEnqueuer world) { | 208 WorldImpact run(Compiler compiler, CodegenEnqueuer world) { |
209 if (world.isProcessed(element)) return const WorldImpact(); | 209 if (world.isProcessed(element)) return const WorldImpact(); |
210 | 210 |
211 registry = new CodegenRegistry(compiler, resolutionTree); | 211 registry = new CodegenRegistry(compiler, resolutionTree); |
212 return compiler.codegen(this, world); | 212 return compiler.codegen(this, world); |
213 } | 213 } |
214 } | 214 } |
OLD | NEW |