| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 /// [membersUsed] with the usage changes for each member. | 82 /// [membersUsed] with the usage changes for each member. |
| 83 void registerDynamicUse(DynamicUse dynamicUse, MemberUsedCallback memberUsed); | 83 void registerDynamicUse(DynamicUse dynamicUse, MemberUsedCallback memberUsed); |
| 84 | 84 |
| 85 /// Applies the [staticUse] to applicable members. Calls [membersUsed] with | 85 /// Applies the [staticUse] to applicable members. Calls [membersUsed] with |
| 86 /// the usage changes for each member. | 86 /// the usage changes for each member. |
| 87 void registerStaticUse(StaticUse staticUse, MemberUsedCallback memberUsed); | 87 void registerStaticUse(StaticUse staticUse, MemberUsedCallback memberUsed); |
| 88 | 88 |
| 89 /// Register the constant [use] with this world builder. Returns `true` if | 89 /// Register the constant [use] with this world builder. Returns `true` if |
| 90 /// the constant use was new to the world. | 90 /// the constant use was new to the world. |
| 91 bool registerConstantUse(ConstantUse use); | 91 bool registerConstantUse(ConstantUse use); |
| 92 |
| 93 bool isMemberProcessed(MemberEntity member); |
| 94 void registerProcessedMember(MemberEntity member); |
| 95 Iterable<MemberEntity> get processedMembers; |
| 92 } | 96 } |
| 93 | 97 |
| 94 /// The type and kind of an instantiation registered through | 98 /// The type and kind of an instantiation registered through |
| 95 /// `ResolutionWorldBuilder.registerTypeInstantiation`. | 99 /// `ResolutionWorldBuilder.registerTypeInstantiation`. |
| 96 class Instance { | 100 class Instance { |
| 97 final InterfaceType type; | 101 final InterfaceType type; |
| 98 final Instantiation kind; | 102 final Instantiation kind; |
| 99 final bool isRedirection; | 103 final bool isRedirection; |
| 100 | 104 |
| 101 Instance(this.type, this.kind, {this.isRedirection: false}); | 105 Instance(this.type, this.kind, {this.isRedirection: false}); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 new Map<ClassEntity, Set<ClassEntity>>(); | 369 new Map<ClassEntity, Set<ClassEntity>>(); |
| 366 | 370 |
| 367 // We keep track of subtype and subclass relationships in four | 371 // We keep track of subtype and subclass relationships in four |
| 368 // distinct sets to make class hierarchy analysis faster. | 372 // distinct sets to make class hierarchy analysis faster. |
| 369 final Map<ClassEntity, ClassHierarchyNode> _classHierarchyNodes = | 373 final Map<ClassEntity, ClassHierarchyNode> _classHierarchyNodes = |
| 370 <ClassEntity, ClassHierarchyNode>{}; | 374 <ClassEntity, ClassHierarchyNode>{}; |
| 371 final Map<ClassEntity, ClassSet> _classSets = <ClassEntity, ClassSet>{}; | 375 final Map<ClassEntity, ClassSet> _classSets = <ClassEntity, ClassSet>{}; |
| 372 | 376 |
| 373 final Set<ConstantValue> _constantValues = new Set<ConstantValue>(); | 377 final Set<ConstantValue> _constantValues = new Set<ConstantValue>(); |
| 374 | 378 |
| 379 Set<MemberEntity> _processedMembers = new Set<MemberEntity>(); |
| 380 |
| 375 bool get isClosed => _closed; | 381 bool get isClosed => _closed; |
| 376 | 382 |
| 377 ResolutionWorldBuilderBase( | 383 ResolutionWorldBuilderBase( |
| 378 this._options, | 384 this._options, |
| 379 this._elementEnvironment, | 385 this._elementEnvironment, |
| 380 this._dartTypes, | 386 this._dartTypes, |
| 381 this._commonElements, | 387 this._commonElements, |
| 382 this._constantSystem, | 388 this._constantSystem, |
| 383 this._nativeBasicData, | 389 this._nativeBasicData, |
| 384 this._nativeDataBuilder, | 390 this._nativeDataBuilder, |
| 385 this._interceptorDataBuilder, | 391 this._interceptorDataBuilder, |
| 386 this._backendUsageBuilder, | 392 this._backendUsageBuilder, |
| 387 this._rtiNeedBuilder, | 393 this._rtiNeedBuilder, |
| 388 this._nativeResolutionEnqueuer, | 394 this._nativeResolutionEnqueuer, |
| 389 this.selectorConstraintsStrategy); | 395 this.selectorConstraintsStrategy); |
| 390 | 396 |
| 391 Iterable<ClassEntity> get processedClasses => _processedClasses.keys | 397 Iterable<ClassEntity> get processedClasses => _processedClasses.keys |
| 392 .where((cls) => _processedClasses[cls].isInstantiated); | 398 .where((cls) => _processedClasses[cls].isInstantiated); |
| 393 | 399 |
| 400 bool isMemberProcessed(MemberEntity member) => |
| 401 _processedMembers.contains(member); |
| 402 void registerProcessedMember(MemberEntity member) { |
| 403 _processedMembers.add(member); |
| 404 } |
| 405 |
| 406 Iterable<MemberEntity> get processedMembers => _processedMembers; |
| 407 |
| 394 ClosedWorld get closedWorldForTesting { | 408 ClosedWorld get closedWorldForTesting { |
| 395 if (!_closed) { | 409 if (!_closed) { |
| 396 failedAt( | 410 failedAt( |
| 397 NO_LOCATION_SPANNABLE, "The world builder has not yet been closed."); | 411 NO_LOCATION_SPANNABLE, "The world builder has not yet been closed."); |
| 398 } | 412 } |
| 399 return _closedWorldCache; | 413 return _closedWorldCache; |
| 400 } | 414 } |
| 401 | 415 |
| 402 /// All directly instantiated classes, that is, classes with a generative | 416 /// All directly instantiated classes, that is, classes with a generative |
| 403 /// constructor that has been called directly and not only through a | 417 /// constructor that has been called directly and not only through a |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 nativeData: _nativeDataBuilder.close(), | 1010 nativeData: _nativeDataBuilder.close(), |
| 997 interceptorData: _interceptorDataBuilder.close(), | 1011 interceptorData: _interceptorDataBuilder.close(), |
| 998 backendUsage: _backendUsageBuilder.close(), | 1012 backendUsage: _backendUsageBuilder.close(), |
| 999 resolutionWorldBuilder: this, | 1013 resolutionWorldBuilder: this, |
| 1000 rtiNeedBuilder: _rtiNeedBuilder, | 1014 rtiNeedBuilder: _rtiNeedBuilder, |
| 1001 constantSystem: _constantSystem, | 1015 constantSystem: _constantSystem, |
| 1002 implementedClasses: _implementedClasses, | 1016 implementedClasses: _implementedClasses, |
| 1003 liveNativeClasses: _nativeResolutionEnqueuer.liveNativeClasses, | 1017 liveNativeClasses: _nativeResolutionEnqueuer.liveNativeClasses, |
| 1004 liveInstanceMembers: _liveInstanceMembers, | 1018 liveInstanceMembers: _liveInstanceMembers, |
| 1005 assignedInstanceMembers: computeAssignedInstanceMembers(), | 1019 assignedInstanceMembers: computeAssignedInstanceMembers(), |
| 1020 processedMembers: _processedMembers, |
| 1006 allTypedefs: _allTypedefs, | 1021 allTypedefs: _allTypedefs, |
| 1007 mixinUses: _mixinUses, | 1022 mixinUses: _mixinUses, |
| 1008 typesImplementedBySubclasses: typesImplementedBySubclasses, | 1023 typesImplementedBySubclasses: typesImplementedBySubclasses, |
| 1009 classHierarchyNodes: _classHierarchyNodes, | 1024 classHierarchyNodes: _classHierarchyNodes, |
| 1010 classSets: _classSets); | 1025 classSets: _classSets); |
| 1011 } | 1026 } |
| 1012 | 1027 |
| 1013 @override | 1028 @override |
| 1014 void registerClass(ClassEntity cls) { | 1029 void registerClass(ClassEntity cls) { |
| 1015 throw new UnimplementedError('KernelResolutionWorldBuilder.registerClass'); | 1030 throw new UnimplementedError('KernelResolutionWorldBuilder.registerClass'); |
| 1016 } | 1031 } |
| 1017 } | 1032 } |
| OLD | NEW |