Skip to content

Commit d0e5270

Browse files
authored
Merge pull request swiftlang#28898 from rintaro/ide-completion-rdar58102910
[CodeCompletion] Eliminate CodeCompletionCallbacks::completeExpr()
2 parents 3cda934 + ab04751 commit d0e5270

File tree

3 files changed

+0
-26
lines changed

3 files changed

+0
-26
lines changed

include/swift/Parse/CodeCompletionCallbacks.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ class CodeCompletionCallbacks {
118118
/// Set target decl for attribute if the CC token is in attribute of the decl.
119119
virtual void setAttrTargetDeclKind(Optional<DeclKind> DK) {}
120120

121-
/// Complete the whole expression. This is a fallback that should
122-
/// produce results when more specific completion methods failed.
123-
virtual void completeExpr() {};
124-
125121
/// Complete expr-dot after we have consumed the dot.
126122
virtual void completeDotExpr(Expr *E, SourceLoc DotLoc) {};
127123

lib/IDE/CodeCompletion.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,10 +1260,6 @@ class CodeCompletionCallbacksImpl : public CodeCompletionCallbacks {
12601260
Builder.addTypeAnnotation(ST.getString());
12611261
}
12621262

1263-
/// Set to true when we have delivered code completion results
1264-
/// to the \c Consumer.
1265-
bool DeliveredResults = false;
1266-
12671263
Optional<std::pair<Type, ConcreteDeclRef>> typeCheckParsedExpr() {
12681264
assert(ParsedExpr && "should have an expression");
12691265

@@ -1335,7 +1331,6 @@ class CodeCompletionCallbacksImpl : public CodeCompletionCallbacks {
13351331
AttTargetDK = DK;
13361332
}
13371333

1338-
void completeExpr() override;
13391334
void completeDotExpr(Expr *E, SourceLoc DotLoc) override;
13401335
void completeStmtOrExpr(CodeCompletionExpr *E) override;
13411336
void completePostfixExprBeginning(CodeCompletionExpr *E) override;
@@ -1381,18 +1376,6 @@ class CodeCompletionCallbacksImpl : public CodeCompletionCallbacks {
13811376
};
13821377
} // end anonymous namespace
13831378

1384-
void CodeCompletionCallbacksImpl::completeExpr() {
1385-
if (DeliveredResults)
1386-
return;
1387-
1388-
Parser::ParserPositionRAII RestorePosition(P);
1389-
P.restoreParserPosition(ExprBeginPosition);
1390-
1391-
// FIXME: implement fallback code completion.
1392-
1393-
deliverCompletionResults();
1394-
}
1395-
13961379
namespace {
13971380
static bool isTopLevelContext(const DeclContext *DC) {
13981381
for (; DC && DC->isLocalContext(); DC = DC->getParent()) {
@@ -5631,7 +5614,6 @@ void CodeCompletionCallbacksImpl::deliverCompletionResults() {
56315614
Consumer.handleResultsAndModules(CompletionContext, RequestedModules,
56325615
DCForModules);
56335616
RequestedModules.clear();
5634-
DeliveredResults = true;
56355617
}
56365618

56375619
void PrintingCodeCompletionConsumer::handleResults(

lib/Parse/ParseStmt.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,6 @@ ParserStatus Parser::parseExprOrStmt(ASTNode &Result) {
167167
}
168168
}
169169

170-
if (ResultExpr.hasCodeCompletion() && CodeCompletion) {
171-
CodeCompletion->completeExpr();
172-
}
173-
174170
return ResultExpr;
175171
}
176172

0 commit comments

Comments
 (0)