mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Refactoring] SyntacticRename should walk into ObjC Keypath components when matching name locations.
It wasn't previously so missed them. Resolves rdar://61573935
This commit is contained in:
@@ -424,6 +424,36 @@ std::pair<bool, Expr*> NameMatcher::walkToExprPre(Expr *E) {
|
||||
return {false, nullptr};
|
||||
return {false, E};
|
||||
}
|
||||
case ExprKind::KeyPath: {
|
||||
KeyPathExpr *KP = cast<KeyPathExpr>(E);
|
||||
|
||||
// Swift keypath components are visited already, so there's no need to
|
||||
// handle them specially.
|
||||
if (!KP->isObjC())
|
||||
break;
|
||||
|
||||
for (auto Component: KP->getComponents()) {
|
||||
switch (Component.getKind()) {
|
||||
case KeyPathExpr::Component::Kind::UnresolvedProperty:
|
||||
case KeyPathExpr::Component::Kind::Property:
|
||||
tryResolve(ASTWalker::ParentTy(E), Component.getLoc());
|
||||
break;
|
||||
case KeyPathExpr::Component::Kind::DictionaryKey:
|
||||
case KeyPathExpr::Component::Kind::Invalid:
|
||||
break;
|
||||
case KeyPathExpr::Component::Kind::OptionalForce:
|
||||
case KeyPathExpr::Component::Kind::OptionalChain:
|
||||
case KeyPathExpr::Component::Kind::OptionalWrap:
|
||||
case KeyPathExpr::Component::Kind::UnresolvedSubscript:
|
||||
case KeyPathExpr::Component::Kind::Subscript:
|
||||
case KeyPathExpr::Component::Kind::Identity:
|
||||
case KeyPathExpr::Component::Kind::TupleElement:
|
||||
llvm_unreachable("Unexpected component in ObjC KeyPath expression");
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: // ignored
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user