@@ -3788,43 +3788,18 @@ bool RefactoringActionTrailingClosure::performChange() {
3788
3788
return false ;
3789
3789
}
3790
3790
3791
- static bool rangeStartMayNeedRename (const ResolvedRangeInfo &Info) {
3792
- switch (Info.Kind ) {
3793
- case RangeKind::SingleExpression: {
3794
- Expr *E = Info.ContainedNodes [0 ].get <Expr*>();
3795
- // We should show rename for the selection of "foo()"
3796
- if (auto *CE = dyn_cast<CallExpr>(E)) {
3797
- if (CE->getFn ()->getKind () == ExprKind::DeclRef)
3798
- return true ;
3799
-
3800
- // When callling an instance method inside another instance method,
3801
- // we have a dot syntax call whose dot and base are both implicit. We
3802
- // need to explicitly allow the specific case here.
3803
- if (auto *DSC = dyn_cast<DotSyntaxCallExpr>(CE->getFn ())) {
3804
- if (DSC->getBase ()->isImplicit () &&
3805
- DSC->getFn ()->getStartLoc () == Info.TokensInRange .front ().getLoc ())
3806
- return true ;
3807
- }
3808
- }
3809
- return false ;
3810
- }
3811
- case RangeKind::PartOfExpression: {
3812
- if (auto *CE = dyn_cast<CallExpr>(Info.CommonExprParent )) {
3813
- if (auto *DSC = dyn_cast<DotSyntaxCallExpr>(CE->getFn ())) {
3814
- if (DSC->getFn ()->getStartLoc () == Info.TokensInRange .front ().getLoc ())
3815
- return true ;
3816
- }
3817
- }
3818
- return false ;
3819
- }
3820
- case RangeKind::SingleDecl:
3821
- case RangeKind::MultiTypeMemberDecl:
3822
- case RangeKind::SingleStatement:
3823
- case RangeKind::MultiStatement:
3824
- case RangeKind::Invalid:
3825
- return false ;
3791
+ static bool collectRangeStartRefactorings (const ResolvedRangeInfo &Info) {
3792
+ switch (Info.Kind ) {
3793
+ case RangeKind::SingleExpression:
3794
+ case RangeKind::SingleStatement:
3795
+ case RangeKind::SingleDecl:
3796
+ case RangeKind::PartOfExpression:
3797
+ return true ;
3798
+ case RangeKind::MultiStatement:
3799
+ case RangeKind::MultiTypeMemberDecl:
3800
+ case RangeKind::Invalid:
3801
+ return false ;
3826
3802
}
3827
- llvm_unreachable (" unhandled kind" );
3828
3803
}
3829
3804
3830
3805
bool RefactoringActionConvertToComputedProperty::
@@ -8312,7 +8287,7 @@ void swift::ide::collectAvailableRefactorings(
8312
8287
}
8313
8288
8314
8289
void swift::ide::collectAvailableRefactorings (
8315
- SourceFile *SF, RangeConfig Range, bool &RangeStartMayNeedRename ,
8290
+ SourceFile *SF, RangeConfig Range, bool &CollectRangeStartRefactorings ,
8316
8291
SmallVectorImpl<RefactoringKind> &Kinds,
8317
8292
ArrayRef<DiagnosticConsumer *> DiagConsumers) {
8318
8293
if (Range.Length == 0 ) {
@@ -8341,7 +8316,7 @@ void swift::ide::collectAvailableRefactorings(
8341
8316
RANGE_REFACTORING (KIND, NAME, ID)
8342
8317
#include " swift/IDE/RefactoringKinds.def"
8343
8318
8344
- RangeStartMayNeedRename = rangeStartMayNeedRename (Result);
8319
+ CollectRangeStartRefactorings = collectRangeStartRefactorings (Result);
8345
8320
}
8346
8321
8347
8322
bool swift::ide::
0 commit comments