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<LocalFunctionElement> get localFunctions; | 10 Iterable<LocalFunctionElement> get localFunctions; |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 case StaticUseKind.DIRECT_USE: | 658 case StaticUseKind.DIRECT_USE: |
659 case StaticUseKind.CONSTRUCTOR_INVOKE: | 659 case StaticUseKind.CONSTRUCTOR_INVOKE: |
660 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE: | 660 case StaticUseKind.CONST_CONSTRUCTOR_INVOKE: |
661 case StaticUseKind.REDIRECTION: | 661 case StaticUseKind.REDIRECTION: |
662 useSet.addAll(usage.normalUse()); | 662 useSet.addAll(usage.normalUse()); |
663 break; | 663 break; |
664 case StaticUseKind.DIRECT_INVOKE: | 664 case StaticUseKind.DIRECT_INVOKE: |
665 invariant( | 665 invariant( |
666 element, 'Direct static use is not supported for resolution.'); | 666 element, 'Direct static use is not supported for resolution.'); |
667 break; | 667 break; |
| 668 case StaticUseKind.INLINING: |
| 669 throw new SpannableAssertionFailure(CURRENT_ELEMENT_SPANNABLE, |
| 670 "Static use ${staticUse.kind} is not supported during resolution."); |
668 } | 671 } |
669 if (useSet.isNotEmpty) { | 672 if (useSet.isNotEmpty) { |
670 memberUsed(usage.entity, useSet); | 673 memberUsed(usage.entity, useSet); |
671 } | 674 } |
672 } | 675 } |
673 | 676 |
674 /// Return the canonical [_ClassUsage] for [cls]. | 677 /// Return the canonical [_ClassUsage] for [cls]. |
675 _ClassUsage _getClassUsage(ClassElement cls) { | 678 _ClassUsage _getClassUsage(ClassElement cls) { |
676 return _processedClasses.putIfAbsent(cls, () { | 679 return _processedClasses.putIfAbsent(cls, () { |
677 cls.ensureResolved(_resolution); | 680 cls.ensureResolved(_resolution); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 @override | 949 @override |
947 bool isMemberUsed(MemberEntity member) { | 950 bool isMemberUsed(MemberEntity member) { |
948 if (member.isInstanceMember) { | 951 if (member.isInstanceMember) { |
949 _MemberUsage usage = _instanceMemberUsage[member]; | 952 _MemberUsage usage = _instanceMemberUsage[member]; |
950 if (usage != null && usage.hasUse) return true; | 953 if (usage != null && usage.hasUse) return true; |
951 } | 954 } |
952 _StaticMemberUsage usage = _staticMemberUsage[member]; | 955 _StaticMemberUsage usage = _staticMemberUsage[member]; |
953 return usage != null && usage.hasUse; | 956 return usage != null && usage.hasUse; |
954 } | 957 } |
955 } | 958 } |
OLD | NEW |