Skip to content

Commit 634a6eb

Browse files
author
David Ungar
committed
Remove code for updating closure body.
1 parent 3076912 commit 634a6eb

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3220,26 +3220,6 @@ void Parser::parseDeclListDelayed(IterableDeclContext *IDC) {
32203220
}
32213221
}
32223222

3223-
/// Return copy of \p existingNodes with \p newNode inserted in source order
3224-
static SmallVector<ASTNode, 8> insertInOrder(ArrayRef<ASTNode> existingNodes,
3225-
const ASTNode newNode,
3226-
SourceManager &SM) {
3227-
SmallVector<ASTNode, 8> nodesWithInsertion;
3228-
bool didInsert = false;
3229-
auto newNodeStart = newNode.getStartLoc();
3230-
for (auto n : existingNodes) {
3231-
if (SM.isBeforeInBuffer(newNodeStart, n.getStartLoc())) {
3232-
nodesWithInsertion.push_back(newNode);
3233-
didInsert = true;
3234-
}
3235-
nodesWithInsertion.push_back(n);
3236-
}
3237-
if (!didInsert)
3238-
nodesWithInsertion.push_back(newNode);
3239-
3240-
return nodesWithInsertion;
3241-
}
3242-
32433223
void Parser::parseDeclDelayed() {
32443224
auto DelayedState = State->takeDelayedDeclState();
32453225
assert(DelayedState.get() && "should have delayed state");
@@ -3277,15 +3257,6 @@ void Parser::parseDeclDelayed() {
32773257
ED->addMember(D);
32783258
} else if (auto *SF = dyn_cast<SourceFile>(parent)) {
32793259
SF->Decls.push_back(D);
3280-
} else if (auto *CE = dyn_cast<ClosureExpr>(parent)) {
3281-
// Replace the closure body with one including the new Decl, inserted in
3282-
// order.
3283-
auto *const body = CE->getBody();
3284-
auto Elts = insertInOrder(body->getElements(), D, SourceMgr);
3285-
auto *newBody =
3286-
BraceStmt::create(Context, body->getLBraceLoc(), Elts,
3287-
body->getRBraceLoc(), body->isImplicit());
3288-
CE->setBody(newBody, false);
32893260
}
32903261
}
32913262
});

0 commit comments

Comments
 (0)