[SourceKit] Merge local refactoring implementations

Retrieving local rename ranges and the local rename refactoring both had
almost identical methods, except for the addition of retrieving the
outermost shadowed decl that was added a couple months back. Merge them.

Resolves rdar://106529370.
This commit is contained in:
Ben Barham
2023-03-10 12:32:11 -08:00
parent 5f8338f8ef
commit d2de8ed83c
7 changed files with 187 additions and 166 deletions

View File

@@ -704,14 +704,14 @@ static bool passCursorInfoForModule(ModuleEntity Mod,
static void
collectAvailableRenameInfo(const ValueDecl *VD, Optional<RenameRefInfo> RefInfo,
SmallVectorImpl<RefactoringInfo> &Refactorings) {
SmallVector<RenameAvailabilityInfo, 2> Renames;
collectRenameAvailabilityInfo(VD, RefInfo, Renames);
for (auto Info : Renames) {
Refactorings.emplace_back(
SwiftLangSupport::getUIDForRefactoringKind(Info.Kind),
ide::getDescriptiveRefactoringKindName(Info.Kind),
ide::getDescriptiveRenameUnavailableReason(Info.AvailableKind));
}
Optional<RenameAvailabilityInfo> Info = renameAvailabilityInfo(VD, RefInfo);
if (!Info)
return;
Refactorings.emplace_back(
SwiftLangSupport::getUIDForRefactoringKind(Info->Kind),
ide::getDescriptiveRefactoringKindName(Info->Kind),
ide::getDescriptiveRenameUnavailableReason(Info->AvailableKind));
}
static void collectAvailableRefactoringsOtherThanRename(