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_elements.dart'; | 7 import '../elements/elements.dart' show ClassElement, LocalFunctionElement; |
8 import '../elements/elements.dart' show LocalFunctionElement; | |
9 import '../elements/entities.dart'; | 8 import '../elements/entities.dart'; |
10 import '../elements/types.dart' show DartType, InterfaceType; | 9 import '../elements/types.dart' show DartType, InterfaceType; |
11 import '../universe/use.dart' show ConstantUse, DynamicUse, StaticUse, TypeUse; | 10 import '../universe/use.dart' show ConstantUse, DynamicUse, StaticUse, TypeUse; |
12 import '../universe/world_impact.dart' | 11 import '../universe/world_impact.dart' |
13 show WorldImpact, WorldImpactBuilderImpl, WorldImpactVisitor; | 12 show WorldImpact, WorldImpactBuilderImpl, WorldImpactVisitor; |
14 import '../util/enumset.dart'; | 13 import '../util/enumset.dart'; |
15 import '../util/util.dart' show Pair, Setlet; | 14 import '../util/util.dart' show Pair, Setlet; |
16 import 'work.dart' show WorkItem; | 15 import 'work.dart' show WorkItem; |
17 | 16 |
18 class CodegenImpact extends WorldImpact { | 17 class CodegenImpact extends WorldImpact { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 Iterable<AsyncMarker> get asyncMarkers { | 102 Iterable<AsyncMarker> get asyncMarkers { |
104 return _asyncMarkers != null | 103 return _asyncMarkers != null |
105 ? _asyncMarkers.iterable(AsyncMarker.values) | 104 ? _asyncMarkers.iterable(AsyncMarker.values) |
106 : const <AsyncMarker>[]; | 105 : const <AsyncMarker>[]; |
107 } | 106 } |
108 } | 107 } |
109 | 108 |
110 // TODO(johnniwinther): Split this class into interface and implementation. | 109 // TODO(johnniwinther): Split this class into interface and implementation. |
111 // TODO(johnniwinther): Move this implementation to the JS backend. | 110 // TODO(johnniwinther): Move this implementation to the JS backend. |
112 class CodegenRegistry { | 111 class CodegenRegistry { |
113 final ElementEnvironment _elementEnvironment; | |
114 final MemberEntity currentElement; | 112 final MemberEntity currentElement; |
115 final _CodegenImpact worldImpact; | 113 final _CodegenImpact worldImpact; |
116 | 114 |
117 CodegenRegistry(this._elementEnvironment, this.currentElement) | 115 CodegenRegistry(this.currentElement) |
118 : this.worldImpact = new _CodegenImpact(); | 116 : this.worldImpact = new _CodegenImpact(); |
119 | 117 |
120 bool get isForResolution => false; | 118 bool get isForResolution => false; |
121 | 119 |
122 String toString() => 'CodegenRegistry for $currentElement'; | 120 String toString() => 'CodegenRegistry for $currentElement'; |
123 | 121 |
124 @deprecated | 122 @deprecated |
125 void registerInstantiatedClass(ClassEntity element) { | 123 void registerInstantiatedClass(ClassElement element) { |
126 registerInstantiation(_elementEnvironment.getRawType(element)); | 124 registerInstantiation(element.rawType); |
127 } | 125 } |
128 | 126 |
129 void registerStaticUse(StaticUse staticUse) { | 127 void registerStaticUse(StaticUse staticUse) { |
130 worldImpact.registerStaticUse(staticUse); | 128 worldImpact.registerStaticUse(staticUse); |
131 } | 129 } |
132 | 130 |
133 void registerDynamicUse(DynamicUse dynamicUse) { | 131 void registerDynamicUse(DynamicUse dynamicUse) { |
134 worldImpact.registerDynamicUse(dynamicUse); | 132 worldImpact.registerDynamicUse(dynamicUse); |
135 } | 133 } |
136 | 134 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 167 |
170 void registerAsyncMarker(AsyncMarker asyncMarker) { | 168 void registerAsyncMarker(AsyncMarker asyncMarker) { |
171 worldImpact.registerAsyncMarker(asyncMarker); | 169 worldImpact.registerAsyncMarker(asyncMarker); |
172 } | 170 } |
173 } | 171 } |
174 | 172 |
175 /// [WorkItem] used exclusively by the [CodegenEnqueuer]. | 173 /// [WorkItem] used exclusively by the [CodegenEnqueuer]. |
176 abstract class CodegenWorkItem extends WorkItem { | 174 abstract class CodegenWorkItem extends WorkItem { |
177 CodegenRegistry get registry; | 175 CodegenRegistry get registry; |
178 } | 176 } |
OLD | NEW |