mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Index] Handle shorthand if let/closure captures in local rename
Update rename to pull the outermost-declaration so that references are correctly found. Rather than keeping suppressed locations in the current parent, keep them for the whole index. Local rename starts the lookup from the innermost context it can, which could be a closure. In that case there is no parent decl on the stack and thus no where to store the locations to suppress. We could have a specific store for this case, but there shouldn't be that many of these and they're relatively cheap to store anyway. Resolves rdar://104568539.
This commit is contained in:
@@ -912,6 +912,11 @@ bool RefactoringActionLocalRename::performChange() {
|
||||
auto ValueRefCursorInfo = dyn_cast<ResolvedValueRefCursorInfo>(&CursorInfo);
|
||||
if (ValueRefCursorInfo && ValueRefCursorInfo->getValueD()) {
|
||||
ValueDecl *VD = ValueRefCursorInfo->typeOrValue();
|
||||
// The index always uses the outermost shadow for references
|
||||
if (!ValueRefCursorInfo->getShorthandShadowedDecls().empty()) {
|
||||
VD = ValueRefCursorInfo->getShorthandShadowedDecls().back();
|
||||
}
|
||||
|
||||
SmallVector<DeclContext *, 8> Scopes;
|
||||
|
||||
Optional<RenameRefInfo> RefInfo;
|
||||
|
||||
Reference in New Issue
Block a user