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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 ConstructorElement constructor = _constructor; | 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 ResolutionDartType targetType = |
78 constructor.computeEffectiveTargetType(instance.type); | 78 constructor.computeEffectiveTargetType(instance.type); |
79 ClassElement cls = target.enclosingClass; | 79 ClassElement cls = target.enclosingClass; |
80 bool isNative = _nativeBasicData.isNativeClass(cls); | 80 bool isNative = _nativeBasicData.isNativeClass(cls); |
81 Instantiation kind; | 81 Instantiation kind; |
82 if (isNative) { | 82 if (isNative) { |
83 kind = Instantiation.ABSTRACTLY_INSTANTIATED; | 83 kind = Instantiation.ABSTRACTLY_INSTANTIATED; |
84 } else if (cls.isAbstract) { | 84 } else if (cls.isAbstract) { |
85 kind = Instantiation.UNINSTANTIATED; | 85 kind = Instantiation.UNINSTANTIATED; |
86 } else { | 86 } else { |
87 kind = Instantiation.DIRECTLY_INSTANTIATED; | 87 kind = Instantiation.DIRECTLY_INSTANTIATED; |
88 } | 88 } |
89 infoFor(targetType.element) | 89 if (targetType is ResolutionInterfaceType) { |
90 .addInstantiation(target, targetType, kind); | 90 infoFor(targetType.element) |
| 91 .addInstantiation(target, targetType, kind); |
| 92 } |
91 } | 93 } |
92 } | 94 } |
93 }); | 95 }); |
94 } | 96 } |
95 }); | 97 }); |
96 return instantiationMap; | 98 return instantiationMap; |
97 } | 99 } |
98 | 100 |
99 void registerIsCheck(ResolutionDartType type) { | 101 void registerIsCheck(ResolutionDartType type) { |
100 type.computeUnaliased(_resolution); | 102 type.computeUnaliased(_resolution); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 classSets: _classSets); | 191 classSets: _classSets); |
190 } | 192 } |
191 | 193 |
192 @override | 194 @override |
193 void registerMixinUse( | 195 void registerMixinUse( |
194 MixinApplicationElement mixinApplication, ClassElement mixin) { | 196 MixinApplicationElement mixinApplication, ClassElement mixin) { |
195 assert(mixin.isDeclaration); | 197 assert(mixin.isDeclaration); |
196 super.registerMixinUse(mixinApplication, mixin); | 198 super.registerMixinUse(mixinApplication, mixin); |
197 } | 199 } |
198 } | 200 } |
OLD | NEW |