@@ -1609,39 +1609,6 @@ void CodeCompletionCallbacksImpl::afterPoundCompletion(SourceLoc CompletionLoc,
1609
1609
Consumer.handleResults (CompletionContext);
1610
1610
}
1611
1611
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
-
1645
1612
void CodeCompletionCallbacksImpl::doneParsing (SourceFile *SrcFile) {
1646
1613
CompletionContext.CodeCompletionKind = Kind;
1647
1614
@@ -1699,7 +1666,6 @@ void CodeCompletionCallbacksImpl::doneParsing(SourceFile *SrcFile) {
1699
1666
break ;
1700
1667
}
1701
1668
1702
- undoSingleExpressionReturn (CurDeclContext);
1703
1669
if (Kind != CompletionKind::TypeSimpleWithDot) {
1704
1670
// Type member completion does not need a type-checked AST.
1705
1671
typeCheckContextAt (
0 commit comments