SourceKitd: Properly record enclosing statement to ensure expanding to trailing closures consistently. rdar://33477177

This commit is contained in:
Xi Ge
2017-08-28 13:43:09 -07:00
parent 0241a10a9f
commit 5c9099b07e
2 changed files with 14 additions and 2 deletions

View File

@@ -1481,8 +1481,13 @@ private:
bool walkToStmtPre(Stmt *S) override {
auto SR = S->getSourceRange();
if (SR.isValid() && SM.rangeContainsTokenLoc(SR, TargetLoc)) {
if (!EnclosingCall && !isa<BraceStmt>(S))
OuterStmt = S;
if (!EnclosingCall) {
if (isa<BraceStmt>(S))
// In case OuterStmt is already set, we should clear it to nullptr.
OuterStmt = nullptr;
else
OuterStmt = S;
}
}
return true;
}