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. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 Map<ClassEntity, InstantiationInfo> instantiationMap = | 57 Map<ClassEntity, InstantiationInfo> instantiationMap = |
58 <ClassEntity, InstantiationInfo>{}; | 58 <ClassEntity, InstantiationInfo>{}; |
59 | 59 |
60 InstantiationInfo infoFor(ClassEntity cls) { | 60 InstantiationInfo infoFor(ClassEntity cls) { |
61 return instantiationMap.putIfAbsent(cls, () => new InstantiationInfo()); | 61 return instantiationMap.putIfAbsent(cls, () => new InstantiationInfo()); |
62 } | 62 } |
63 | 63 |
64 _instantiationInfo.forEach((cls, info) { | 64 _instantiationInfo.forEach((cls, info) { |
65 if (info.instantiationMap != null) { | 65 if (info.instantiationMap != null) { |
66 info.instantiationMap | 66 info.instantiationMap.forEach((_constructor, Set<Instance> set) { |
67 .forEach((ConstructorElement constructor, Set<Instance> set) { | 67 ConstructorElement constructor = _constructor; |
68 for (Instance instance in set) { | 68 for (Instance instance in set) { |
69 if (instance.isRedirection) { | 69 if (instance.isRedirection) { |
70 continue; | 70 continue; |
71 } | 71 } |
72 if (constructor == null || !constructor.isRedirectingFactory) { | 72 if (constructor == null || !constructor.isRedirectingFactory) { |
73 infoFor(cls) | 73 infoFor(cls) |
74 .addInstantiation(constructor, instance.type, instance.kind); | 74 .addInstantiation(constructor, instance.type, instance.kind); |
75 } else { | 75 } else { |
76 ConstructorElement target = constructor.effectiveTarget; | 76 ConstructorElement target = constructor.effectiveTarget; |
77 ResolutionInterfaceType targetType = | 77 ResolutionInterfaceType targetType = |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 classSets: _classSets); | 189 classSets: _classSets); |
190 } | 190 } |
191 | 191 |
192 @override | 192 @override |
193 void registerMixinUse( | 193 void registerMixinUse( |
194 MixinApplicationElement mixinApplication, ClassElement mixin) { | 194 MixinApplicationElement mixinApplication, ClassElement mixin) { |
195 assert(mixin.isDeclaration); | 195 assert(mixin.isDeclaration); |
196 super.registerMixinUse(mixinApplication, mixin); | 196 super.registerMixinUse(mixinApplication, mixin); |
197 } | 197 } |
198 } | 198 } |
OLD | NEW |