Skip to content

Commit 6aa8bfd

Browse files
committed
Corrected autoclosure handling.
Set autoclosure discriminators and follow visit single expression by way of visiting brace stmt.
1 parent 25bbef1 commit 6aa8bfd

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

lib/AST/ASTWalker.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -313,15 +313,6 @@ class Traversal : public ASTVisitor<Traversal, Expr*, Stmt*,
313313
PrettyStackTraceDecl debugStack("walking into body of", AFD);
314314
#endif
315315

316-
if (AFD->hasSingleExpressionBody()) {
317-
if (auto body = AFD->getSingleExpressionBody()) {
318-
if ((body = doIt(body)))
319-
AFD->setSingleExpressionBody(body);
320-
else
321-
return true;
322-
}
323-
}
324-
325316
bool WalkGenerics = AFD->getGenericParams() &&
326317
Walker.shouldWalkIntoGenericParams() &&
327318
// accessor generics are visited from the storage decl

lib/Sema/TypeCheckStmt.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,6 +1946,7 @@ bool TypeChecker::typeCheckFunctionBodyUntil(FuncDecl *FD,
19461946
/*skipClosures*/false);
19471947
if (E != FD->getSingleExpressionBody())
19481948
FD->setSingleExpressionBody(E);
1949+
setAutoClosureDiscriminators(FD, BS);
19491950
FD->setBody(BS);
19501951
return false;
19511952
} else {
@@ -1970,6 +1971,7 @@ bool TypeChecker::typeCheckFunctionBodyUntil(FuncDecl *FD,
19701971
/*discardedExpr=*/false,
19711972
/*skipClosures*/false);
19721973
BS->setElement(0, E);
1974+
setAutoClosureDiscriminators(FD, BS);
19731975
FD->setBody(BS);
19741976
return false;
19751977
}
@@ -2002,6 +2004,7 @@ bool TypeChecker::typeCheckFunctionBodyUntil(FuncDecl *FD,
20022004
/*skipClosures*/false);
20032005
if (E != FD->getSingleExpressionBody())
20042006
FD->setSingleExpressionBody(E);
2007+
setAutoClosureDiscriminators(FD, BS);
20052008
FD->setBody(BS);
20062009
}
20072010
return HadSalvageError;

0 commit comments

Comments
 (0)