| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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.kernel.frontend_strategy; | 5 library dart2js.kernel.frontend_strategy; |
| 6 | 6 |
| 7 import '../closure.dart'; | 7 import '../closure.dart'; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common_elements.dart'; | 9 import '../common_elements.dart'; |
| 10 import '../common/backend_api.dart'; | 10 import '../common/backend_api.dart'; |
| 11 import '../common/resolution.dart'; | 11 import '../common/resolution.dart'; |
| 12 import '../common/tasks.dart'; | 12 import '../common/tasks.dart'; |
| 13 import '../common/work.dart'; | 13 import '../common/work.dart'; |
| 14 import '../elements/elements.dart'; | 14 import '../elements/elements.dart'; |
| 15 import '../elements/entities.dart'; | 15 import '../elements/entities.dart'; |
| 16 import '../elements/types.dart'; | 16 import '../elements/types.dart'; |
| 17 import '../environment.dart' as env; | 17 import '../environment.dart' as env; |
| 18 import '../enqueue.dart'; | 18 import '../enqueue.dart'; |
| 19 import '../frontend_strategy.dart'; | 19 import '../frontend_strategy.dart'; |
| 20 import '../js_backend/backend.dart'; | 20 import '../js_backend/backend.dart'; |
| 21 import '../js_backend/backend_usage.dart'; | 21 import '../js_backend/backend_usage.dart'; |
| 22 import '../js_backend/custom_elements_analysis.dart'; | |
| 23 import '../js_backend/interceptor_data.dart'; | 22 import '../js_backend/interceptor_data.dart'; |
| 24 import '../js_backend/mirrors_analysis.dart'; | 23 import '../js_backend/mirrors_analysis.dart'; |
| 25 import '../js_backend/mirrors_data.dart'; | 24 import '../js_backend/mirrors_data.dart'; |
| 26 import '../js_backend/native_data.dart'; | 25 import '../js_backend/native_data.dart'; |
| 27 import '../js_backend/no_such_method_registry.dart'; | 26 import '../js_backend/no_such_method_registry.dart'; |
| 28 import '../js_backend/runtime_types.dart'; | 27 import '../js_backend/runtime_types.dart'; |
| 29 import '../library_loader.dart'; | 28 import '../library_loader.dart'; |
| 30 import '../native/resolver.dart'; | 29 import '../native/resolver.dart'; |
| 31 import '../serialization/task.dart'; | 30 import '../serialization/task.dart'; |
| 32 import '../patch_parser.dart'; | 31 import '../patch_parser.dart'; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 return new KernelNoSuchMethodResolver(elementMap); | 80 return new KernelNoSuchMethodResolver(elementMap); |
| 82 } | 81 } |
| 83 | 82 |
| 84 /// Computes the main function from [mainLibrary] adding additional world | 83 /// Computes the main function from [mainLibrary] adding additional world |
| 85 /// impact to [impactBuilder]. | 84 /// impact to [impactBuilder]. |
| 86 FunctionEntity computeMain( | 85 FunctionEntity computeMain( |
| 87 LibraryEntity mainLibrary, WorldImpactBuilder impactBuilder) { | 86 LibraryEntity mainLibrary, WorldImpactBuilder impactBuilder) { |
| 88 return elementEnvironment.mainFunction; | 87 return elementEnvironment.mainFunction; |
| 89 } | 88 } |
| 90 | 89 |
| 91 CustomElementsResolutionAnalysis createCustomElementsResolutionAnalysis( | |
| 92 NativeBasicData nativeBasicData, | |
| 93 BackendUsageBuilder backendUsageBuilder) { | |
| 94 return new CustomElementsResolutionAnalysisImpl(); | |
| 95 } | |
| 96 | |
| 97 MirrorsDataBuilder createMirrorsDataBuilder() { | 90 MirrorsDataBuilder createMirrorsDataBuilder() { |
| 98 return new MirrorsDataBuilderImpl(); | 91 return new MirrorsDataBuilderImpl(elementMap.commonElements); |
| 99 } | 92 } |
| 100 | 93 |
| 101 MirrorsResolutionAnalysis createMirrorsResolutionAnalysis( | 94 MirrorsResolutionAnalysis createMirrorsResolutionAnalysis( |
| 102 JavaScriptBackend backend) { | 95 JavaScriptBackend backend) { |
| 103 return new MirrorsResolutionAnalysisImpl(); | 96 return new MirrorsResolutionAnalysisImpl(); |
| 104 } | 97 } |
| 105 | 98 |
| 106 RuntimeTypesNeedBuilder createRuntimeTypesNeedBuilder() { | 99 RuntimeTypesNeedBuilder createRuntimeTypesNeedBuilder() { |
| 107 return new RuntimeTypesNeedBuilderImpl( | 100 return new RuntimeTypesNeedBuilderImpl( |
| 108 elementEnvironment, elementMap.types); | 101 elementEnvironment, elementMap.types); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 @override | 160 @override |
| 168 WorldImpact run() { | 161 WorldImpact run() { |
| 169 _nativeMemberResolver.resolveNativeMember(element); | 162 _nativeMemberResolver.resolveNativeMember(element); |
| 170 ResolutionImpact impact = _elementMap.computeWorldImpact(element); | 163 ResolutionImpact impact = _elementMap.computeWorldImpact(element); |
| 171 return _impactTransformer.transformResolutionImpact(impact); | 164 return _impactTransformer.transformResolutionImpact(impact); |
| 172 } | 165 } |
| 173 } | 166 } |
| 174 | 167 |
| 175 /// Mock implementation of [MirrorsDataImpl]. | 168 /// Mock implementation of [MirrorsDataImpl]. |
| 176 class MirrorsDataBuilderImpl extends MirrorsDataImpl { | 169 class MirrorsDataBuilderImpl extends MirrorsDataImpl { |
| 177 MirrorsDataBuilderImpl() : super(null, null, null); | 170 MirrorsDataBuilderImpl(CommonElements commonElements) |
| 171 : super(null, null, commonElements); |
| 178 | 172 |
| 179 @override | 173 @override |
| 180 void registerUsedMember(MemberEntity member) {} | 174 void registerUsedMember(MemberEntity member) {} |
| 181 | 175 |
| 182 @override | 176 @override |
| 183 void computeMembersNeededForReflection( | 177 void computeMembersNeededForReflection( |
| 184 ResolutionWorldBuilder worldBuilder, ClosedWorld closedWorld) { | 178 ResolutionWorldBuilder worldBuilder, ClosedWorld closedWorld) { |
| 185 // TODO(johnniwinther): Support dart:mirrors. | 179 // TODO(johnniwinther): Support dart:mirrors. |
| 186 createImmutableSets(); | 180 createImmutableSets(); |
| 187 } | 181 } |
| 188 | 182 |
| 189 @override | 183 @override |
| 190 void maybeMarkClosureAsNeededForReflection( | 184 void maybeMarkClosureAsNeededForReflection( |
| 191 ClosureClassElement globalizedElement, | 185 ClosureClassElement globalizedElement, |
| 192 FunctionElement callFunction, | 186 FunctionElement callFunction, |
| 193 FunctionElement function) {} | 187 FunctionElement function) {} |
| 194 | 188 |
| 195 @override | 189 @override |
| 196 void registerConstSymbol(String name) {} | 190 void registerConstSymbol(String name) {} |
| 197 | 191 |
| 198 @override | 192 @override |
| 199 void registerMirrorUsage( | 193 void registerMirrorUsage( |
| 200 Set<String> symbols, Set<Element> targets, Set<Element> metaTargets) {} | 194 Set<String> symbols, Set<Element> targets, Set<Element> metaTargets) {} |
| 201 } | 195 } |
| 202 | 196 |
| 203 /// Mock implementation of [CustomElementsResolutionAnalysis]. | |
| 204 class CustomElementsResolutionAnalysisImpl | |
| 205 implements CustomElementsResolutionAnalysis { | |
| 206 @override | |
| 207 CustomElementsAnalysisJoin get join { | |
| 208 throw new UnimplementedError('CustomElementsResolutionAnalysisImpl.join'); | |
| 209 } | |
| 210 | |
| 211 @override | |
| 212 WorldImpact flush() { | |
| 213 // TODO(johnniwinther): Implement this. | |
| 214 return const WorldImpact(); | |
| 215 } | |
| 216 | |
| 217 @override | |
| 218 void registerStaticUse(MemberEntity element) {} | |
| 219 | |
| 220 @override | |
| 221 void registerInstantiatedClass(ClassEntity classElement) {} | |
| 222 | |
| 223 @override | |
| 224 void registerTypeLiteral(DartType type) {} | |
| 225 } | |
| 226 | |
| 227 /// Mock implementation of [MirrorsResolutionAnalysis]. | 197 /// Mock implementation of [MirrorsResolutionAnalysis]. |
| 228 class MirrorsResolutionAnalysisImpl implements MirrorsResolutionAnalysis { | 198 class MirrorsResolutionAnalysisImpl implements MirrorsResolutionAnalysis { |
| 229 @override | 199 @override |
| 230 void onQueueEmpty(Enqueuer enqueuer, Iterable<ClassEntity> recentClasses) {} | 200 void onQueueEmpty(Enqueuer enqueuer, Iterable<ClassEntity> recentClasses) {} |
| 231 | 201 |
| 232 @override | 202 @override |
| 233 MirrorsCodegenAnalysis close() { | 203 MirrorsCodegenAnalysis close() { |
| 234 // TODO(johnniwinther): Implement this. | 204 // TODO(johnniwinther): Implement this. |
| 235 return new MirrorsCodegenAnalysisImpl(); | 205 return new MirrorsCodegenAnalysisImpl(); |
| 236 } | 206 } |
| 237 | 207 |
| 238 @override | 208 @override |
| 239 void onResolutionComplete() {} | 209 void onResolutionComplete() {} |
| 240 } | 210 } |
| 241 | 211 |
| 242 class MirrorsCodegenAnalysisImpl implements MirrorsCodegenAnalysis { | 212 class MirrorsCodegenAnalysisImpl implements MirrorsCodegenAnalysis { |
| 243 @override | 213 @override |
| 244 int get preMirrorsMethodCount { | 214 int get preMirrorsMethodCount { |
| 245 // TODO(johnniwinther): Implement this. | 215 // TODO(johnniwinther): Implement this. |
| 246 return null; | 216 return null; |
| 247 } | 217 } |
| 248 | 218 |
| 249 @override | 219 @override |
| 250 void onQueueEmpty(Enqueuer enqueuer, Iterable<ClassEntity> recentClasses) { | 220 void onQueueEmpty(Enqueuer enqueuer, Iterable<ClassEntity> recentClasses) { |
| 251 // TODO(johnniwinther): Implement this. | 221 // TODO(johnniwinther): Implement this. |
| 252 } | 222 } |
| 253 } | 223 } |
| OLD | NEW |