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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 class CodegenRegistry extends Registry { | 43 class CodegenRegistry extends Registry { |
44 final Compiler compiler; | 44 final Compiler compiler; |
45 final TreeElements treeElements; | 45 final TreeElements treeElements; |
46 | 46 |
47 CodegenRegistry(this.compiler, this.treeElements); | 47 CodegenRegistry(this.compiler, this.treeElements); |
48 | 48 |
49 bool get isForResolution => false; | 49 bool get isForResolution => false; |
50 | 50 |
51 Element get currentElement => treeElements.analyzedElement; | 51 Element get currentElement => treeElements.analyzedElement; |
52 | 52 |
53 String toString() => 'CodegenRegistry for $currentElement'; | |
54 | |
55 // TODO(johnniwinther): Remove this getter when [Registry] creates a | 53 // TODO(johnniwinther): Remove this getter when [Registry] creates a |
56 // dependency node. | 54 // dependency node. |
57 Setlet<Element> get otherDependencies => treeElements.otherDependencies; | 55 Setlet<Element> get otherDependencies => treeElements.otherDependencies; |
58 | 56 |
59 CodegenEnqueuer get world => compiler.enqueuer.codegen; | 57 CodegenEnqueuer get world => compiler.enqueuer.codegen; |
60 JavaScriptBackend get backend => compiler.backend; | 58 JavaScriptBackend get backend => compiler.backend; |
61 | 59 |
62 void registerAssert(bool hasMessage) { | 60 void registerAssert(bool hasMessage) { |
63 // Codegen does not register asserts. They have been lowered to calls. | 61 // Codegen does not register asserts. They have been lowered to calls. |
64 assert(false); | 62 assert(false); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 203 |
206 TreeElements get resolutionTree => element.resolvedAst.elements; | 204 TreeElements get resolutionTree => element.resolvedAst.elements; |
207 | 205 |
208 WorldImpact run(Compiler compiler, CodegenEnqueuer world) { | 206 WorldImpact run(Compiler compiler, CodegenEnqueuer world) { |
209 if (world.isProcessed(element)) return const WorldImpact(); | 207 if (world.isProcessed(element)) return const WorldImpact(); |
210 | 208 |
211 registry = new CodegenRegistry(compiler, resolutionTree); | 209 registry = new CodegenRegistry(compiler, resolutionTree); |
212 return compiler.codegen(this, world); | 210 return compiler.codegen(this, world); |
213 } | 211 } |
214 } | 212 } |
OLD | NEW |