Skip to content

[CodeCompletion] Eliminate CodeCompletionCallbacks::completeExpr() #28898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions include/swift/Parse/CodeCompletionCallbacks.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,6 @@ class CodeCompletionCallbacks {
/// Set target decl for attribute if the CC token is in attribute of the decl.
virtual void setAttrTargetDeclKind(Optional<DeclKind> DK) {}

/// Complete the whole expression. This is a fallback that should
/// produce results when more specific completion methods failed.
virtual void completeExpr() {};

/// Complete expr-dot after we have consumed the dot.
virtual void completeDotExpr(Expr *E, SourceLoc DotLoc) {};

Expand Down
18 changes: 0 additions & 18 deletions lib/IDE/CodeCompletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1260,10 +1260,6 @@ class CodeCompletionCallbacksImpl : public CodeCompletionCallbacks {
Builder.addTypeAnnotation(ST.getString());
}

/// Set to true when we have delivered code completion results
/// to the \c Consumer.
bool DeliveredResults = false;

Optional<std::pair<Type, ConcreteDeclRef>> typeCheckParsedExpr() {
assert(ParsedExpr && "should have an expression");

Expand Down Expand Up @@ -1335,7 +1331,6 @@ class CodeCompletionCallbacksImpl : public CodeCompletionCallbacks {
AttTargetDK = DK;
}

void completeExpr() override;
void completeDotExpr(Expr *E, SourceLoc DotLoc) override;
void completeStmtOrExpr(CodeCompletionExpr *E) override;
void completePostfixExprBeginning(CodeCompletionExpr *E) override;
Expand Down Expand Up @@ -1381,18 +1376,6 @@ class CodeCompletionCallbacksImpl : public CodeCompletionCallbacks {
};
} // end anonymous namespace

void CodeCompletionCallbacksImpl::completeExpr() {
if (DeliveredResults)
return;

Parser::ParserPositionRAII RestorePosition(P);
P.restoreParserPosition(ExprBeginPosition);

// FIXME: implement fallback code completion.

deliverCompletionResults();
}

namespace {
static bool isTopLevelContext(const DeclContext *DC) {
for (; DC && DC->isLocalContext(); DC = DC->getParent()) {
Expand Down Expand Up @@ -5631,7 +5614,6 @@ void CodeCompletionCallbacksImpl::deliverCompletionResults() {
Consumer.handleResultsAndModules(CompletionContext, RequestedModules,
DCForModules);
RequestedModules.clear();
DeliveredResults = true;
}

void PrintingCodeCompletionConsumer::handleResults(
Expand Down
4 changes: 0 additions & 4 deletions lib/Parse/ParseStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,6 @@ ParserStatus Parser::parseExprOrStmt(ASTNode &Result) {
}
}

if (ResultExpr.hasCodeCompletion() && CodeCompletion) {
CodeCompletion->completeExpr();
}

return ResultExpr;
}

Expand Down