OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 universe; | 5 library universe; |
6 | 6 |
7 import '../elements/elements.dart'; | 7 import '../elements/elements.dart'; |
8 import '../dart2jslib.dart'; | 8 import '../dart2jslib.dart'; |
9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
10 import '../types/types.dart'; | 10 import '../types/types.dart'; |
(...skipping 19 matching lines...) Expand all Loading... |
30 /// | 30 /// |
31 /// See [_directlyInstantiatedClasses]. | 31 /// See [_directlyInstantiatedClasses]. |
32 final Set<DartType> _instantiatedTypes = new Set<DartType>(); | 32 final Set<DartType> _instantiatedTypes = new Set<DartType>(); |
33 | 33 |
34 /// The set of all instantiated classes, either directly, as superclasses or | 34 /// The set of all instantiated classes, either directly, as superclasses or |
35 /// as supertypes. | 35 /// as supertypes. |
36 /// | 36 /// |
37 /// Invariant: Elements are declaration elements. | 37 /// Invariant: Elements are declaration elements. |
38 final Set<ClassElement> _allInstantiatedClasses = new Set<ClassElement>(); | 38 final Set<ClassElement> _allInstantiatedClasses = new Set<ClassElement>(); |
39 | 39 |
| 40 /// The set of all referenced static fields. |
| 41 /// |
| 42 /// Invariant: Elements are declaration elements. |
| 43 final Set<FieldElement> allReferencedStaticFields = new Set<FieldElement>(); |
| 44 |
40 /** | 45 /** |
41 * Documentation wanted -- johnniwinther | 46 * Documentation wanted -- johnniwinther |
42 * | 47 * |
43 * Invariant: Elements are declaration elements. | 48 * Invariant: Elements are declaration elements. |
44 */ | 49 */ |
45 final Set<FunctionElement> staticFunctionsNeedingGetter = | 50 final Set<FunctionElement> staticFunctionsNeedingGetter = |
46 new Set<FunctionElement>(); | 51 new Set<FunctionElement>(); |
47 final Set<FunctionElement> methodsNeedingSuperGetter = | 52 final Set<FunctionElement> methodsNeedingSuperGetter = |
48 new Set<FunctionElement>(); | 53 new Set<FunctionElement>(); |
49 final Map<String, Set<Selector>> invokedNames = | 54 final Map<String, Set<Selector>> invokedNames = |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 183 |
179 DartType registerIsCheck(DartType type, Compiler compiler) { | 184 DartType registerIsCheck(DartType type, Compiler compiler) { |
180 type = type.unalias(compiler); | 185 type = type.unalias(compiler); |
181 // Even in checked mode, type annotations for return type and argument | 186 // Even in checked mode, type annotations for return type and argument |
182 // types do not imply type checks, so there should never be a check | 187 // types do not imply type checks, so there should never be a check |
183 // against the type variable of a typedef. | 188 // against the type variable of a typedef. |
184 isChecks.add(type); | 189 isChecks.add(type); |
185 return type; | 190 return type; |
186 } | 191 } |
187 | 192 |
| 193 void registerStaticFieldUse(FieldElement staticField) { |
| 194 assert(Elements.isStaticOrTopLevel(staticField) && staticField.isField); |
| 195 assert(staticField.isDeclaration); |
| 196 |
| 197 allReferencedStaticFields.add(staticField); |
| 198 } |
| 199 |
188 void forgetElement(Element element, Compiler compiler) { | 200 void forgetElement(Element element, Compiler compiler) { |
189 allClosures.remove(element); | 201 allClosures.remove(element); |
190 slowDirectlyNestedClosures(element).forEach(compiler.forgetElement); | 202 slowDirectlyNestedClosures(element).forEach(compiler.forgetElement); |
191 closurizedMembers.remove(element); | 203 closurizedMembers.remove(element); |
192 fieldSetters.remove(element); | 204 fieldSetters.remove(element); |
193 fieldGetters.remove(element); | 205 fieldGetters.remove(element); |
194 _directlyInstantiatedClasses.remove(element); | 206 _directlyInstantiatedClasses.remove(element); |
195 _allInstantiatedClasses.remove(element); | 207 _allInstantiatedClasses.remove(element); |
196 if (element is ClassElement) { | 208 if (element is ClassElement) { |
197 assert(invariant( | 209 assert(invariant( |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 | 859 |
848 Selector extendIfReachesAll(Compiler compiler) { | 860 Selector extendIfReachesAll(Compiler compiler) { |
849 bool canReachAll = compiler.enabledInvokeOn | 861 bool canReachAll = compiler.enabledInvokeOn |
850 && mask.needsNoSuchMethodHandling(this, compiler.world); | 862 && mask.needsNoSuchMethodHandling(this, compiler.world); |
851 return canReachAll | 863 return canReachAll |
852 ? new TypedSelector( | 864 ? new TypedSelector( |
853 compiler.typesTask.dynamicType, this, compiler.world) | 865 compiler.typesTask.dynamicType, this, compiler.world) |
854 : this; | 866 : this; |
855 } | 867 } |
856 } | 868 } |
OLD | NEW |