|
38 | 38 | #include "swift/IDE/CodeCompletionStringPrinter.h"
|
39 | 39 | #include "swift/IDE/CompletionLookup.h"
|
40 | 40 | #include "swift/IDE/CompletionOverrideLookup.h"
|
| 41 | +#include "swift/IDE/DotExprCompletion.h" |
41 | 42 | #include "swift/IDE/Utils.h"
|
42 | 43 | #include "swift/Parse/CodeCompletionCallbacks.h"
|
43 | 44 | #include "swift/Sema/CodeCompletionTypeChecking.h"
|
@@ -653,7 +654,7 @@ void CodeCompletionCallbacksImpl::completeTypeAttrBeginning() {
|
653 | 654 | Kind = CompletionKind::TypeAttrBeginning;
|
654 | 655 | }
|
655 | 656 |
|
656 |
| -static bool isDynamicLookup(Type T) { |
| 657 | +bool swift::ide::isDynamicLookup(Type T) { |
657 | 658 | return T->getRValueType()->isAnyObject();
|
658 | 659 | }
|
659 | 660 |
|
@@ -1198,10 +1199,9 @@ void swift::ide::postProcessResults(
|
1198 | 1199 | }
|
1199 | 1200 | }
|
1200 | 1201 |
|
1201 |
| -static void deliverCompletionResults(CodeCompletionContext &CompletionContext, |
1202 |
| - CompletionLookup &Lookup, |
1203 |
| - DeclContext *DC, |
1204 |
| - CodeCompletionConsumer &Consumer) { |
| 1202 | +void swift::ide::deliverCompletionResults( |
| 1203 | + CodeCompletionContext &CompletionContext, CompletionLookup &Lookup, |
| 1204 | + DeclContext *DC, CodeCompletionConsumer &Consumer) { |
1205 | 1205 | auto &SF = *DC->getParentSourceFile();
|
1206 | 1206 | llvm::SmallPtrSet<Identifier, 8> seenModuleNames;
|
1207 | 1207 | std::vector<RequestedCachedModule> RequestedModules;
|
@@ -1396,46 +1396,6 @@ void deliverKeyPathResults(
|
1396 | 1396 | deliverCompletionResults(CompletionCtx, Lookup, DC, Consumer);
|
1397 | 1397 | }
|
1398 | 1398 |
|
1399 |
| -void deliverDotExprResults( |
1400 |
| - ArrayRef<DotExprTypeCheckCompletionCallback::Result> Results, |
1401 |
| - Expr *BaseExpr, DeclContext *DC, SourceLoc DotLoc, bool IsInSelector, |
1402 |
| - ide::CodeCompletionContext &CompletionCtx, |
1403 |
| - CodeCompletionConsumer &Consumer) { |
1404 |
| - ASTContext &Ctx = DC->getASTContext(); |
1405 |
| - CompletionLookup Lookup(CompletionCtx.getResultSink(), Ctx, DC, |
1406 |
| - &CompletionCtx); |
1407 |
| - |
1408 |
| - if (DotLoc.isValid()) |
1409 |
| - Lookup.setHaveDot(DotLoc); |
1410 |
| - |
1411 |
| - Lookup.setIsSuperRefExpr(isa<SuperRefExpr>(BaseExpr)); |
1412 |
| - |
1413 |
| - if (auto *DRE = dyn_cast<DeclRefExpr>(BaseExpr)) |
1414 |
| - Lookup.setIsSelfRefExpr(DRE->getDecl()->getName() == Ctx.Id_self); |
1415 |
| - |
1416 |
| - if (isa<BindOptionalExpr>(BaseExpr) || isa<ForceValueExpr>(BaseExpr)) |
1417 |
| - Lookup.setIsUnwrappedOptional(true); |
1418 |
| - |
1419 |
| - if (IsInSelector) { |
1420 |
| - Lookup.includeInstanceMembers(); |
1421 |
| - Lookup.setPreferFunctionReferencesToCalls(); |
1422 |
| - } |
1423 |
| - |
1424 |
| - Lookup.shouldCheckForDuplicates(Results.size() > 1); |
1425 |
| - for (auto &Result: Results) { |
1426 |
| - Lookup.setIsStaticMetatype(Result.BaseIsStaticMetaType); |
1427 |
| - Lookup.getPostfixKeywordCompletions(Result.BaseTy, BaseExpr); |
1428 |
| - Lookup.setExpectedTypes(Result.ExpectedTypes, |
1429 |
| - Result.IsImplicitSingleExpressionReturn, |
1430 |
| - Result.ExpectsNonVoid); |
1431 |
| - if (isDynamicLookup(Result.BaseTy)) |
1432 |
| - Lookup.setIsDynamicLookup(); |
1433 |
| - Lookup.getValueExprCompletions(Result.BaseTy, Result.BaseDecl); |
1434 |
| - } |
1435 |
| - |
1436 |
| - deliverCompletionResults(CompletionCtx, Lookup, DC, Consumer); |
1437 |
| -} |
1438 |
| - |
1439 | 1399 | bool CodeCompletionCallbacksImpl::trySolverCompletion(bool MaybeFuncBody) {
|
1440 | 1400 | assert(ParsedExpr || CurDeclContext);
|
1441 | 1401 |
|
|
0 commit comments