@@ -1609,39 +1609,6 @@ void CodeCompletionCallbacksImpl::afterPoundCompletion(SourceLoc CompletionLoc,
16091609 Consumer.handleResults (CompletionContext);
16101610}
16111611
1612- // Undoes the single-expression closure/function body transformation on the
1613- // given DeclContext and its parent contexts if they have a single expression
1614- // body that contains the code completion location.
1615- //
1616- // FIXME: Remove this once all expression position completions are migrated
1617- // to work via TypeCheckCompletionCallback.
1618- static void undoSingleExpressionReturn (DeclContext *DC) {
1619- auto updateBody = [](BraceStmt *BS, ASTContext &Ctx) -> bool {
1620- ASTNode LastElem = BS->getLastElement ();
1621- auto *RS = dyn_cast_or_null<ReturnStmt>(LastElem.dyn_cast <Stmt*>());
1622-
1623- if (!RS || !RS->isImplicit ())
1624- return false ;
1625-
1626- BS->setLastElement (RS->getResult ());
1627- return true ;
1628- };
1629-
1630- while (ClosureExpr *CE = dyn_cast_or_null<ClosureExpr>(DC)) {
1631- if (CE->hasSingleExpressionBody ()) {
1632- if (updateBody (CE->getBody (), CE->getASTContext ()))
1633- CE->setBody (CE->getBody (), false );
1634- }
1635- DC = DC->getParent ();
1636- }
1637- if (FuncDecl *FD = dyn_cast_or_null<FuncDecl>(DC)) {
1638- if (FD->hasSingleExpressionBody ()) {
1639- if (updateBody (FD->getBody (), FD->getASTContext ()))
1640- FD->setHasSingleExpressionBody (false );
1641- }
1642- }
1643- }
1644-
16451612void CodeCompletionCallbacksImpl::doneParsing (SourceFile *SrcFile) {
16461613 CompletionContext.CodeCompletionKind = Kind;
16471614
@@ -1699,7 +1666,6 @@ void CodeCompletionCallbacksImpl::doneParsing(SourceFile *SrcFile) {
16991666 break ;
17001667 }
17011668
1702- undoSingleExpressionReturn (CurDeclContext);
17031669 if (Kind != CompletionKind::TypeSimpleWithDot) {
17041670 // Type member completion does not need a type-checked AST.
17051671 typeCheckContextAt (
0 commit comments