Skip to content

Commit cb538c4

Browse files
committed
[CodeCompletion] Rename DotExprCompletion -> PostfixCompletion
1 parent 28fccd1 commit cb538c4

File tree

4 files changed

+26
-29
lines changed

4 files changed

+26
-29
lines changed

include/swift/IDE/DotExprCompletion.h renamed to include/swift/IDE/PostfixCompletion.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#ifndef SWIFT_IDE_DOTEXPRCODECOMPLETION_H
14-
#define SWIFT_IDE_DOTEXPRCODECOMPLETION_H
13+
#ifndef SWIFT_IDE_POSTFIXCOMPLETION_H
14+
#define SWIFT_IDE_POSTFIXCOMPLETION_H
1515

1616
#include "swift/IDE/CodeCompletionConsumer.h"
1717
#include "swift/IDE/CodeCompletionContext.h"
@@ -20,10 +20,9 @@
2020
namespace swift {
2121
namespace ide {
2222

23-
/// Used to collect and store information needed to perform member completion
24-
/// (\c CompletionKind::DotExpr ) from the solutions formed during expression
25-
/// type-checking.
26-
class DotExprTypeCheckCompletionCallback : public TypeCheckCompletionCallback {
23+
/// Used to collect and store information needed to perform postfix completion
24+
/// (either <base>.#^COMPLETE^# or <base>#^COMPLETE^#).
25+
class PostfixCompletionCallback : public TypeCheckCompletionCallback {
2726
struct Result {
2827
/// The type that we are completing on. Will never be null.
2928
Type BaseTy;
@@ -83,8 +82,7 @@ class DotExprTypeCheckCompletionCallback : public TypeCheckCompletionCallback {
8382
void sawSolutionImpl(const constraints::Solution &solution) override;
8483

8584
public:
86-
DotExprTypeCheckCompletionCallback(CodeCompletionExpr *CompletionExpr,
87-
DeclContext *DC)
85+
PostfixCompletionCallback(CodeCompletionExpr *CompletionExpr, DeclContext *DC)
8886
: CompletionExpr(CompletionExpr), DC(DC) {}
8987

9088
/// Typecheck the code completion expression in isolation, calling
@@ -109,4 +107,4 @@ class DotExprTypeCheckCompletionCallback : public TypeCheckCompletionCallback {
109107
} // end namespace ide
110108
} // end namespace swift
111109

112-
#endif // SWIFT_IDE_DOTEXPRCODECOMPLETION_H
110+
#endif // SWIFT_IDE_POSTFIXCOMPLETION_H

lib/IDE/CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11

22
add_swift_host_library(swiftIDE STATIC
33
AfterPoundExprCompletion.cpp
4+
APIDigesterData.cpp
45
ArgumentCompletion.cpp
56
CodeCompletion.cpp
67
CodeCompletionCache.cpp
7-
CodeCompletionContext.cpp
88
CodeCompletionConsumer.cpp
9+
CodeCompletionContext.cpp
910
CodeCompletionDiagnostics.cpp
11+
CodeCompletionResult.cpp
1012
CodeCompletionResultBuilder.cpp
1113
CodeCompletionResultPrinter.cpp
12-
CodeCompletionResult.cpp
1314
CodeCompletionResultType.cpp
1415
CodeCompletionString.cpp
1516
CodeCompletionStringPrinter.cpp
@@ -20,26 +21,25 @@ add_swift_host_library(swiftIDE STATIC
2021
CompletionOverrideLookup.cpp
2122
ConformingMethodList.cpp
2223
DependencyChecking.cpp
23-
DotExprCompletion.cpp
2424
ExprCompletion.cpp
2525
ExprContextAnalysis.cpp
2626
Formatting.cpp
2727
FuzzyStringMatcher.cpp
28-
Refactoring.cpp
28+
IDERequests.cpp
29+
IDETypeChecking.cpp
30+
ImportDepth.cpp
2931
KeyPathCompletion.cpp
3032
ModuleInterfacePrinting.cpp
33+
PostfixCompletion.cpp
34+
Refactoring.cpp
3135
REPLCodeCompletion.cpp
36+
SourceEntityWalker.cpp
3237
SwiftSourceDocInfo.cpp
3338
SyntaxModel.cpp
3439
TypeCheckCompletionCallback.cpp
40+
TypeContextInfo.cpp
3541
UnresolvedMemberCompletion.cpp
3642
Utils.cpp
37-
IDETypeChecking.cpp
38-
ImportDepth.cpp
39-
APIDigesterData.cpp
40-
SourceEntityWalker.cpp
41-
TypeContextInfo.cpp
42-
IDERequests.cpp
4343
)
4444
target_link_libraries(swiftIDE PRIVATE
4545
swiftAST

lib/IDE/CodeCompletion.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
#include "swift/IDE/CodeCompletionStringPrinter.h"
4141
#include "swift/IDE/CompletionLookup.h"
4242
#include "swift/IDE/CompletionOverrideLookup.h"
43-
#include "swift/IDE/DotExprCompletion.h"
4443
#include "swift/IDE/ExprCompletion.h"
4544
#include "swift/IDE/KeyPathCompletion.h"
45+
#include "swift/IDE/PostfixCompletion.h"
4646
#include "swift/IDE/TypeCheckCompletionCallback.h"
4747
#include "swift/IDE/UnresolvedMemberCompletion.h"
4848
#include "swift/IDE/Utils.h"
@@ -1338,8 +1338,7 @@ bool CodeCompletionCallbacksImpl::trySolverCompletion(bool MaybeFuncBody) {
13381338
assert(CodeCompleteTokenExpr);
13391339
assert(CurDeclContext);
13401340

1341-
DotExprTypeCheckCompletionCallback Lookup(CodeCompleteTokenExpr,
1342-
CurDeclContext);
1341+
PostfixCompletionCallback Lookup(CodeCompleteTokenExpr, CurDeclContext);
13431342
llvm::SaveAndRestore<TypeCheckCompletionCallback*>
13441343
CompletionCollector(Context.CompletionCallback, &Lookup);
13451344
typeCheckContextAt(CurDeclContext, CompletionLoc);

lib/IDE/DotExprCompletion.cpp renamed to lib/IDE/PostfixCompletion.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#include "swift/IDE/DotExprCompletion.h"
13+
#include "swift/IDE/PostfixCompletion.h"
1414
#include "swift/IDE/CodeCompletion.h"
1515
#include "swift/IDE/CompletionLookup.h"
1616
#include "swift/Sema/CompletionContextFinder.h"
@@ -21,12 +21,12 @@ using namespace swift;
2121
using namespace swift::constraints;
2222
using namespace swift::ide;
2323

24-
bool DotExprTypeCheckCompletionCallback::Result::canBeMergedWith(
24+
bool PostfixCompletionCallback::Result::canBeMergedWith(
2525
const Result &Other) const {
2626
return BaseTy->isEqual(Other.BaseTy) && BaseDecl == Other.BaseDecl;
2727
}
2828

29-
void DotExprTypeCheckCompletionCallback::Result::merge(const Result &Other) {
29+
void PostfixCompletionCallback::Result::merge(const Result &Other) {
3030
assert(canBeMergedWith(Other));
3131
// These properties should match if we are talking about the same BaseDecl.
3232
assert(IsBaseDeclUnapplied == Other.IsBaseDeclUnapplied);
@@ -45,7 +45,7 @@ void DotExprTypeCheckCompletionCallback::Result::merge(const Result &Other) {
4545
IsInAsyncContext |= Other.IsInAsyncContext;
4646
}
4747

48-
void DotExprTypeCheckCompletionCallback::addResult(const Result &Res) {
48+
void PostfixCompletionCallback::addResult(const Result &Res) {
4949
auto ExistingRes =
5050
llvm::find_if(Results, [&Res](const Result &ExistingResult) {
5151
return ExistingResult.canBeMergedWith(Res);
@@ -57,7 +57,7 @@ void DotExprTypeCheckCompletionCallback::addResult(const Result &Res) {
5757
}
5858
}
5959

60-
void DotExprTypeCheckCompletionCallback::fallbackTypeCheck(DeclContext *DC) {
60+
void PostfixCompletionCallback::fallbackTypeCheck(DeclContext *DC) {
6161
assert(!gotCallback());
6262

6363
// Default to checking the completion expression in isolation.
@@ -103,7 +103,7 @@ static bool isUnappliedFunctionRef(const OverloadChoice &Choice) {
103103
}
104104
}
105105

106-
void DotExprTypeCheckCompletionCallback::sawSolutionImpl(
106+
void PostfixCompletionCallback::sawSolutionImpl(
107107
const constraints::Solution &S) {
108108
auto &CS = S.getConstraintSystem();
109109
auto *ParsedExpr = CompletionExpr->getBase();
@@ -315,7 +315,7 @@ static void addOperatorResults(Type LHSType, ArrayRef<OperatorDecl *> Operators,
315315
}
316316
}
317317

318-
void DotExprTypeCheckCompletionCallback::deliverResults(
318+
void PostfixCompletionCallback::deliverResults(
319319
SourceLoc DotLoc, bool IsInSelector, bool IncludeOperators,
320320
bool HasLeadingSpace, CodeCompletionContext &CompletionCtx,
321321
CodeCompletionConsumer &Consumer) {

0 commit comments

Comments
 (0)