@@ -25,31 +25,48 @@ class ArgumentTypeCheckCompletionCallback : public TypeCheckCompletionCallback {
2525 struct Result {
2626 // / The type associated with the code completion expression itself.
2727 Type ExpectedType;
28+
2829 // / The expected return type of the function call.
2930 Type ExpectedCallType;
31+
3032 // / True if this is a subscript rather than a function call.
3133 bool IsSubscript;
34+
3235 // / The FuncDecl or SubscriptDecl associated with the call.
3336 ValueDecl *FuncD;
37+
3438 // / The type of the function being called.
3539 AnyFunctionType *FuncTy;
40+
3641 // / The index of the argument containing the completion location
3742 unsigned ArgIdx;
43+
3844 // / The index of the parameter corresponding to the completion argument.
3945 llvm::Optional<unsigned > ParamIdx;
46+
4047 // / The indices of all params that were bound to non-synthesized
4148 // / arguments. Used so we don't suggest them even when the args are out of
4249 // / order.
4350 std::set<unsigned > ClaimedParamIndices;
51+
4452 // / True if the completion is a noninitial term in a variadic argument.
4553 bool IsNoninitialVariadic;
54+
4655 // / The base type of the call/subscript (null for free functions).
4756 Type BaseType;
57+
4858 // / True if an argument label precedes the completion location.
4959 bool HasLabel;
60+
61+ // / The argument index of the first trailing closure.
62+ // /
63+ // / \c None if the call doesn't have a trailing closure.
64+ llvm::Optional<unsigned > FirstTrailingClosureIndex;
65+
5066 // / Whether the surrounding context is async and thus calling async
5167 // / functions is supported.
5268 bool IsInAsyncContext;
69+
5370 // / A bitfield to mark whether the parameter at a given index is optional.
5471 // / Parameters can be optional if they have a default argument or belong to
5572 // / a parameter pack.
@@ -93,9 +110,12 @@ class ArgumentTypeCheckCompletionCallback : public TypeCheckCompletionCallback {
93110 // / function signature instead of suggesting individual labels. Used when
94111 // / completing after the opening '(' of a function call \param Loc The
95112 // / location of the code completion token
96- void deliverResults (bool IncludeSignature, SourceLoc Loc, DeclContext *DC,
97- CodeCompletionContext &CompletionCtx,
98- CodeCompletionConsumer &Consumer);
113+ // / \param IsLabeledTrailingClosure Whether we are completing the label of a
114+ // / labeled trailing closure, ie. if the code completion location is outside
115+ // / the call after the first trailing closure of the call.
116+ void collectResults (bool IncludeSignature, bool IsLabeledTrailingClosure,
117+ SourceLoc Loc, DeclContext *DC,
118+ CodeCompletionContext &CompletionCtx);
99119};
100120
101121} // end namespace ide
0 commit comments