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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 type.computeUnaliased(_resolution); | 83 type.computeUnaliased(_resolution); |
84 type = type.unaliased; | 84 type = type.unaliased; |
85 // Even in checked mode, type annotations for return type and argument | 85 // Even in checked mode, type annotations for return type and argument |
86 // types do not imply type checks, so there should never be a check | 86 // types do not imply type checks, so there should never be a check |
87 // against the type variable of a typedef. | 87 // against the type variable of a typedef. |
88 assert(!type.isTypeVariable || !type.element.enclosingElement.isTypedef); | 88 assert(!type.isTypeVariable || !type.element.enclosingElement.isTypedef); |
89 super.registerIsCheck(type); | 89 super.registerIsCheck(type); |
90 } | 90 } |
91 | 91 |
92 void registerStaticUse(StaticUse staticUse, MemberUsedCallback memberUsed) { | 92 void registerStaticUse(StaticUse staticUse, MemberUsedCallback memberUsed) { |
93 if (staticUse.kind == StaticUseKind.CLOSURE) { | 93 Element element = staticUse.element; |
94 LocalFunctionElement localFunction = staticUse.element; | |
95 if (localFunction.type.containsTypeVariables) { | |
96 localFunctionsWithFreeTypeVariables.add(localFunction); | |
97 } | |
98 localFunctions.add(staticUse.element); | |
99 return; | |
100 } | |
101 MemberElement element = staticUse.element; | |
102 assert(invariant(element, element.isDeclaration, | 94 assert(invariant(element, element.isDeclaration, |
103 message: "Element ${element} is not the declaration.")); | 95 message: "Element ${element} is not the declaration.")); |
104 super.registerStaticUse(staticUse, memberUsed); | 96 super.registerStaticUse(staticUse, memberUsed); |
105 } | 97 } |
106 | 98 |
107 _ClassUsage _createClassUsage(ClassElement cls) { | 99 _ClassUsage _createClassUsage(ClassElement cls) { |
108 cls.ensureResolved(_resolution); | 100 cls.ensureResolved(_resolution); |
109 _resolution.ensureClassMembers(cls); | 101 _resolution.ensureClassMembers(cls); |
110 return super._createClassUsage(cls); | 102 return super._createClassUsage(cls); |
111 } | 103 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 } | 243 } |
252 } | 244 } |
253 | 245 |
254 @override | 246 @override |
255 void registerMixinUse( | 247 void registerMixinUse( |
256 MixinApplicationElement mixinApplication, ClassElement mixin) { | 248 MixinApplicationElement mixinApplication, ClassElement mixin) { |
257 assert(mixin.isDeclaration); | 249 assert(mixin.isDeclaration); |
258 super.registerMixinUse(mixinApplication, mixin); | 250 super.registerMixinUse(mixinApplication, mixin); |
259 } | 251 } |
260 } | 252 } |
OLD | NEW |