| 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 abstract class ResolutionWorldBuilder implements WorldBuilder, OpenWorld { | 7 abstract class ResolutionWorldBuilder implements WorldBuilder, OpenWorld { |
| 8 /// Set of all local functions in the program. Used by the mirror tracking | 8 /// Set of all local functions in the program. Used by the mirror tracking |
| 9 /// system to find all live closure instances. | 9 /// system to find all live closure instances. |
| 10 Iterable<Local> get localFunctions; | 10 Iterable<Local> get localFunctions; |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 final Set<FunctionEntity> closurizedMembers = new Set<FunctionEntity>(); | 330 final Set<FunctionEntity> closurizedMembers = new Set<FunctionEntity>(); |
| 331 | 331 |
| 332 /// Set of live closurized members whose signatures reference type variables. | 332 /// Set of live closurized members whose signatures reference type variables. |
| 333 /// | 333 /// |
| 334 /// A closurized method is considered live if the enclosing class has been | 334 /// A closurized method is considered live if the enclosing class has been |
| 335 /// instantiated. | 335 /// instantiated. |
| 336 final Set<FunctionEntity> closurizedMembersWithFreeTypeVariables = | 336 final Set<FunctionEntity> closurizedMembersWithFreeTypeVariables = |
| 337 new Set<FunctionEntity>(); | 337 new Set<FunctionEntity>(); |
| 338 | 338 |
| 339 final ElementEnvironment _elementEnvironment; | 339 final ElementEnvironment _elementEnvironment; |
| 340 | 340 final DartTypes _dartTypes; |
| 341 final CommonElements _commonElements; | 341 final CommonElements _commonElements; |
| 342 final ConstantSystem _constantSystem; | 342 final ConstantSystem _constantSystem; |
| 343 | 343 |
| 344 final NativeBasicData _nativeBasicData; | 344 final NativeBasicData _nativeBasicData; |
| 345 final NativeDataBuilder _nativeDataBuilder; | 345 final NativeDataBuilder _nativeDataBuilder; |
| 346 final InterceptorDataBuilder _interceptorDataBuilder; | 346 final InterceptorDataBuilder _interceptorDataBuilder; |
| 347 final BackendUsageBuilder _backendUsageBuilder; | 347 final BackendUsageBuilder _backendUsageBuilder; |
| 348 | 348 |
| 349 final SelectorConstraintsStrategy selectorConstraintsStrategy; | 349 final SelectorConstraintsStrategy selectorConstraintsStrategy; |
| 350 | 350 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 366 final Map<ClassEntity, ClassHierarchyNode> _classHierarchyNodes = | 366 final Map<ClassEntity, ClassHierarchyNode> _classHierarchyNodes = |
| 367 <ClassEntity, ClassHierarchyNode>{}; | 367 <ClassEntity, ClassHierarchyNode>{}; |
| 368 final Map<ClassEntity, ClassSet> _classSets = <ClassEntity, ClassSet>{}; | 368 final Map<ClassEntity, ClassSet> _classSets = <ClassEntity, ClassSet>{}; |
| 369 | 369 |
| 370 final Set<ConstantValue> _constantValues = new Set<ConstantValue>(); | 370 final Set<ConstantValue> _constantValues = new Set<ConstantValue>(); |
| 371 | 371 |
| 372 bool get isClosed => _closed; | 372 bool get isClosed => _closed; |
| 373 | 373 |
| 374 ResolutionWorldBuilderBase( | 374 ResolutionWorldBuilderBase( |
| 375 this._elementEnvironment, | 375 this._elementEnvironment, |
| 376 this._dartTypes, |
| 376 this._commonElements, | 377 this._commonElements, |
| 377 this._constantSystem, | 378 this._constantSystem, |
| 378 this._nativeBasicData, | 379 this._nativeBasicData, |
| 379 this._nativeDataBuilder, | 380 this._nativeDataBuilder, |
| 380 this._interceptorDataBuilder, | 381 this._interceptorDataBuilder, |
| 381 this._backendUsageBuilder, | 382 this._backendUsageBuilder, |
| 382 this.selectorConstraintsStrategy) { | 383 this.selectorConstraintsStrategy) { |
| 383 _allFunctions = new FunctionSetBuilder(); | 384 _allFunctions = new FunctionSetBuilder(); |
| 384 } | 385 } |
| 385 | 386 |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 return typesImplementedBySubclasses; | 931 return typesImplementedBySubclasses; |
| 931 } | 932 } |
| 932 } | 933 } |
| 933 | 934 |
| 934 abstract class KernelResolutionWorldBuilderBase | 935 abstract class KernelResolutionWorldBuilderBase |
| 935 extends ResolutionWorldBuilderBase { | 936 extends ResolutionWorldBuilderBase { |
| 936 KernelToElementMapImpl get elementMap; | 937 KernelToElementMapImpl get elementMap; |
| 937 | 938 |
| 938 KernelResolutionWorldBuilderBase( | 939 KernelResolutionWorldBuilderBase( |
| 939 ElementEnvironment elementEnvironment, | 940 ElementEnvironment elementEnvironment, |
| 941 DartTypes dartTypes, |
| 940 CommonElements commonElements, | 942 CommonElements commonElements, |
| 941 ConstantSystem constantSystem, | 943 ConstantSystem constantSystem, |
| 942 NativeBasicData nativeBasicData, | 944 NativeBasicData nativeBasicData, |
| 943 NativeDataBuilder nativeDataBuilder, | 945 NativeDataBuilder nativeDataBuilder, |
| 944 InterceptorDataBuilder interceptorDataBuilder, | 946 InterceptorDataBuilder interceptorDataBuilder, |
| 945 BackendUsageBuilder backendUsageBuilder, | 947 BackendUsageBuilder backendUsageBuilder, |
| 946 SelectorConstraintsStrategy selectorConstraintsStrategy) | 948 SelectorConstraintsStrategy selectorConstraintsStrategy) |
| 947 : super( | 949 : super( |
| 948 elementEnvironment, | 950 elementEnvironment, |
| 951 dartTypes, |
| 949 commonElements, | 952 commonElements, |
| 950 constantSystem, | 953 constantSystem, |
| 951 nativeBasicData, | 954 nativeBasicData, |
| 952 nativeDataBuilder, | 955 nativeDataBuilder, |
| 953 interceptorDataBuilder, | 956 interceptorDataBuilder, |
| 954 backendUsageBuilder, | 957 backendUsageBuilder, |
| 955 selectorConstraintsStrategy); | 958 selectorConstraintsStrategy); |
| 956 | 959 |
| 957 @override | 960 @override |
| 958 ClosedWorld closeWorld() { | 961 ClosedWorld closeWorld() { |
| 959 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses = | 962 Map<ClassEntity, Set<ClassEntity>> typesImplementedBySubclasses = |
| 960 populateHierarchyNodes(); | 963 populateHierarchyNodes(); |
| 961 _classHierarchyNodes.keys.toList().forEach(_ensureClassSet); | 964 _classHierarchyNodes.keys.toList().forEach(_ensureClassSet); |
| 962 _closed = true; | 965 _closed = true; |
| 963 assert( | 966 assert( |
| 964 _classHierarchyNodes.length == _classSets.length, | 967 _classHierarchyNodes.length == _classSets.length, |
| 965 "ClassHierarchyNode/ClassSet mismatch: " | 968 "ClassHierarchyNode/ClassSet mismatch: " |
| 966 "$_classHierarchyNodes vs $_classSets"); | 969 "$_classHierarchyNodes vs $_classSets"); |
| 967 return _closedWorldCache = new KernelClosedWorld(elementMap, | 970 return _closedWorldCache = new KernelClosedWorld(elementMap, |
| 968 elementEnvironment: _elementEnvironment, | 971 elementEnvironment: _elementEnvironment, |
| 972 dartTypes: _dartTypes, |
| 969 commonElements: _commonElements, | 973 commonElements: _commonElements, |
| 970 nativeData: _nativeDataBuilder.close(), | 974 nativeData: _nativeDataBuilder.close(), |
| 971 interceptorData: _interceptorDataBuilder.close(), | 975 interceptorData: _interceptorDataBuilder.close(), |
| 972 backendUsage: _backendUsageBuilder.close(), | 976 backendUsage: _backendUsageBuilder.close(), |
| 973 constantSystem: _constantSystem, | 977 constantSystem: _constantSystem, |
| 974 resolutionWorldBuilder: this, | 978 resolutionWorldBuilder: this, |
| 975 implementedClasses: _implementedClasses, | 979 implementedClasses: _implementedClasses, |
| 976 functionSet: _allFunctions.close(), | 980 functionSet: _allFunctions.close(), |
| 977 allTypedefs: _allTypedefs, | 981 allTypedefs: _allTypedefs, |
| 978 mixinUses: _mixinUses, | 982 mixinUses: _mixinUses, |
| 979 typesImplementedBySubclasses: typesImplementedBySubclasses, | 983 typesImplementedBySubclasses: typesImplementedBySubclasses, |
| 980 classHierarchyNodes: _classHierarchyNodes, | 984 classHierarchyNodes: _classHierarchyNodes, |
| 981 classSets: _classSets); | 985 classSets: _classSets); |
| 982 } | 986 } |
| 983 | 987 |
| 984 @override | 988 @override |
| 985 void registerClass(ClassEntity cls) { | 989 void registerClass(ClassEntity cls) { |
| 986 throw new UnimplementedError('KernelResolutionWorldBuilder.registerClass'); | 990 throw new UnimplementedError('KernelResolutionWorldBuilder.registerClass'); |
| 987 } | 991 } |
| 988 } | 992 } |
| OLD | NEW |