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 '../closure.dart' show SynthesizedCallMethodElementX; | 7 import '../closure.dart' show SynthesizedCallMethodElementX; |
8 import '../common.dart'; | 8 import '../common.dart'; |
9 import '../compiler.dart' show Compiler; | 9 import '../compiler.dart' show Compiler; |
10 import '../constants/values.dart' show ConstantValue; | 10 import '../constants/values.dart' show ConstantValue; |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 class CodegenWorkItem extends WorkItem { | 227 class CodegenWorkItem extends WorkItem { |
228 CodegenRegistry registry; | 228 CodegenRegistry registry; |
229 final ResolvedAst resolvedAst; | 229 final ResolvedAst resolvedAst; |
230 | 230 |
231 factory CodegenWorkItem(Compiler compiler, AstElement element, | 231 factory CodegenWorkItem(Compiler compiler, AstElement element, |
232 ItemCompilationContext compilationContext) { | 232 ItemCompilationContext compilationContext) { |
233 // If this assertion fails, the resolution callbacks of the backend may be | 233 // If this assertion fails, the resolution callbacks of the backend may be |
234 // missing call of form registry.registerXXX. Alternatively, the code | 234 // missing call of form registry.registerXXX. Alternatively, the code |
235 // generation could spuriously be adding dependencies on things we know we | 235 // generation could spuriously be adding dependencies on things we know we |
236 // don't need. | 236 // don't need. |
237 assert(invariant(element, compiler.backend.frontend.hasResolvedAst(element), | 237 assert(invariant(element, element.hasResolvedAst, |
238 message: "$element has no resolved ast.")); | 238 message: "$element has no resolved ast.")); |
239 ResolvedAst resolvedAst = compiler.backend.frontend.getResolvedAst(element); | 239 ResolvedAst resolvedAst = element.resolvedAst; |
240 return new CodegenWorkItem.internal(resolvedAst, compilationContext); | 240 return new CodegenWorkItem.internal(resolvedAst, compilationContext); |
241 } | 241 } |
242 | 242 |
243 CodegenWorkItem.internal( | 243 CodegenWorkItem.internal( |
244 ResolvedAst resolvedAst, ItemCompilationContext compilationContext) | 244 ResolvedAst resolvedAst, ItemCompilationContext compilationContext) |
245 : this.resolvedAst = resolvedAst, | 245 : this.resolvedAst = resolvedAst, |
246 super(resolvedAst.element, compilationContext); | 246 super(resolvedAst.element, compilationContext); |
247 | 247 |
248 WorldImpact run(Compiler compiler, CodegenEnqueuer world) { | 248 WorldImpact run(Compiler compiler, CodegenEnqueuer world) { |
249 if (world.isProcessed(element)) return const WorldImpact(); | 249 if (world.isProcessed(element)) return const WorldImpact(); |
250 | 250 |
251 registry = new CodegenRegistry(compiler, element); | 251 registry = new CodegenRegistry(compiler, element); |
252 return compiler.codegen(this, world); | 252 return compiler.codegen(this, world); |
253 } | 253 } |
254 } | 254 } |
OLD | NEW |