| 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 part of world_builder; | 5 part of world_builder; |
| 6 | 6 |
| 7 /// [ResolutionEnqueuerWorldBuilder] based on the [Element] model. | 7 /// [ResolutionEnqueuerWorldBuilder] based on the [Element] model. |
| 8 class ElementResolutionWorldBuilder extends ResolutionWorldBuilderBase { | 8 class ElementResolutionWorldBuilder extends ResolutionWorldBuilderBase { |
| 9 /// Used for testing the new more precise computation of instantiated types | 9 /// Used for testing the new more precise computation of instantiated types |
| 10 /// and classes. | 10 /// and classes. |
| 11 static bool useInstantiationMap = false; | 11 static bool useInstantiationMap = false; |
| 12 | 12 |
| 13 final Resolution _resolution; | 13 final Resolution _resolution; |
| 14 | 14 |
| 15 ElementResolutionWorldBuilder( | 15 ElementResolutionWorldBuilder( |
| 16 JavaScriptBackend backend, | 16 JavaScriptBackend backend, |
| 17 this._resolution, | 17 this._resolution, |
| 18 NativeBasicData nativeBasicData, | 18 NativeBasicData nativeBasicData, |
| 19 NativeDataBuilder nativeDataBuilder, | 19 NativeDataBuilder nativeDataBuilder, |
| 20 InterceptorDataBuilder interceptorDataBuilder, | 20 InterceptorDataBuilder interceptorDataBuilder, |
| 21 BackendUsageBuilder backendUsageBuilder, | 21 BackendUsageBuilder backendUsageBuilder, |
| 22 RuntimeTypesNeedBuilder rtiNeedBuilder, |
| 23 NativeResolutionEnqueuer nativeResolutionEnqueuer, |
| 22 SelectorConstraintsStrategy selectorConstraintsStrategy) | 24 SelectorConstraintsStrategy selectorConstraintsStrategy) |
| 23 : super( | 25 : super( |
| 26 backend.compiler.options, |
| 24 _resolution.elementEnvironment, | 27 _resolution.elementEnvironment, |
| 25 _resolution.types, | 28 _resolution.types, |
| 26 _resolution.commonElements, | 29 _resolution.commonElements, |
| 27 backend.constantSystem, | 30 backend.constantSystem, |
| 28 nativeBasicData, | 31 nativeBasicData, |
| 29 nativeDataBuilder, | 32 nativeDataBuilder, |
| 30 interceptorDataBuilder, | 33 interceptorDataBuilder, |
| 31 backendUsageBuilder, | 34 backendUsageBuilder, |
| 35 rtiNeedBuilder, |
| 36 nativeResolutionEnqueuer, |
| 32 selectorConstraintsStrategy); | 37 selectorConstraintsStrategy); |
| 33 | 38 |
| 34 bool isImplemented(ClassElement cls) { | 39 bool isImplemented(ClassElement cls) { |
| 35 return super.isImplemented(cls.declaration); | 40 return super.isImplemented(cls.declaration); |
| 36 } | 41 } |
| 37 | 42 |
| 38 void registerTypeInstantiation( | 43 void registerTypeInstantiation( |
| 39 InterfaceType type, ClassUsedCallback classUsed, | 44 InterfaceType type, ClassUsedCallback classUsed, |
| 40 {ConstructorEntity constructor, | 45 {ConstructorEntity constructor, |
| 41 bool byMirrors: false, | 46 bool byMirrors: false, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 @override | 173 @override |
| 169 ClassEntity getSuperClass(ClassElement cls) => cls.superclass; | 174 ClassEntity getSuperClass(ClassElement cls) => cls.superclass; |
| 170 | 175 |
| 171 @override | 176 @override |
| 172 Iterable<InterfaceType> getSupertypes(ClassElement cls) => cls.allSupertypes; | 177 Iterable<InterfaceType> getSupertypes(ClassElement cls) => cls.allSupertypes; |
| 173 | 178 |
| 174 ClosedWorld closeWorld() { | 179 ClosedWorld closeWorld() { |
| 175 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses = | 180 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses = |
| 176 populateHierarchyNodes(); | 181 populateHierarchyNodes(); |
| 177 _closed = true; | 182 _closed = true; |
| 183 |
| 178 return _closedWorldCache = new ClosedWorldImpl( | 184 return _closedWorldCache = new ClosedWorldImpl( |
| 185 options: _options, |
| 179 elementEnvironment: _elementEnvironment, | 186 elementEnvironment: _elementEnvironment, |
| 180 dartTypes: _dartTypes, | 187 dartTypes: _dartTypes, |
| 181 commonElements: _commonElements, | 188 commonElements: _commonElements, |
| 182 constantSystem: _constantSystem, | 189 constantSystem: _constantSystem, |
| 183 nativeData: _nativeDataBuilder.close(), | 190 nativeData: _nativeDataBuilder.close(), |
| 184 interceptorData: _interceptorDataBuilder.close(), | 191 interceptorData: _interceptorDataBuilder.close(), |
| 185 backendUsage: _backendUsageBuilder.close(), | 192 backendUsage: _backendUsageBuilder.close(), |
| 193 resolutionWorldBuilder: this, |
| 194 rtiNeedBuilder: _rtiNeedBuilder, |
| 186 implementedClasses: _implementedClasses, | 195 implementedClasses: _implementedClasses, |
| 196 liveNativeClasses: _nativeResolutionEnqueuer.liveNativeClasses, |
| 187 liveInstanceMembers: _liveInstanceMembers, | 197 liveInstanceMembers: _liveInstanceMembers, |
| 188 assignedInstanceMembers: computeAssignedInstanceMembers(), | 198 assignedInstanceMembers: computeAssignedInstanceMembers(), |
| 189 allTypedefs: _allTypedefs, | 199 allTypedefs: _allTypedefs, |
| 190 mixinUses: _mixinUses, | 200 mixinUses: _mixinUses, |
| 191 typesImplementedBySubclasses: typesImplementedBySubclasses, | 201 typesImplementedBySubclasses: typesImplementedBySubclasses, |
| 192 classHierarchyNodes: _classHierarchyNodes, | 202 classHierarchyNodes: _classHierarchyNodes, |
| 193 classSets: _classSets); | 203 classSets: _classSets); |
| 194 } | 204 } |
| 195 | 205 |
| 196 @override | 206 @override |
| 197 void registerMixinUse( | 207 void registerMixinUse( |
| 198 MixinApplicationElement mixinApplication, ClassElement mixin) { | 208 MixinApplicationElement mixinApplication, ClassElement mixin) { |
| 199 assert(mixin.isDeclaration); | 209 assert(mixin.isDeclaration); |
| 200 super.registerMixinUse(mixinApplication, mixin); | 210 super.registerMixinUse(mixinApplication, mixin); |
| 201 } | 211 } |
| 202 } | 212 } |
| OLD | NEW |