mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[IDE] Fix visiting DeferStmt
* Call balanced walkToStmtPost() for DeferStmt. * In walkToStmtPre(), return DeferStmt itself instead of the body. rdar://problem/39948168
This commit is contained in:
@@ -677,11 +677,16 @@ std::pair<bool, Stmt *> ModelASTWalker::walkToStmtPre(Stmt *S) {
|
||||
}
|
||||
|
||||
} else if (auto *DeferS = dyn_cast<DeferStmt>(S)) {
|
||||
// Since 'DeferStmt::getTempDecl()' is marked as implicit, we manually walk
|
||||
// into the body.
|
||||
if (auto *FD = DeferS->getTempDecl()) {
|
||||
auto *RetS = FD->getBody()->walk(*this);
|
||||
// Already walked children.
|
||||
return { false, RetS };
|
||||
assert(RetS == FD->getBody());
|
||||
(void)RetS;
|
||||
walkToStmtPost(DeferS);
|
||||
}
|
||||
// Already walked children.
|
||||
return { false, DeferS };
|
||||
}
|
||||
|
||||
return { true, S };
|
||||
|
||||
Reference in New Issue
Block a user