@@ -5095,6 +5095,7 @@ namespace {
5095
5095
namespace {
5096
5096
using FunctionTypeAndDecl = std::pair<AnyFunctionType *, ValueDecl *>;
5097
5097
5098
+ // / Collect function (or subscript) members with the given \p name on \p baseTy.
5098
5099
void collectPossibleCalleesByQualifiedLookup (
5099
5100
DeclContext &DC, Type baseTy, DeclBaseName name,
5100
5101
SmallVectorImpl<FunctionTypeAndDecl> &candidates) {
@@ -5127,6 +5128,8 @@ void collectPossibleCalleesByQualifiedLookup(
5127
5128
}
5128
5129
}
5129
5130
5131
+ // / Collect function (or subscript) members with the given \p name on
5132
+ // / \p baseExpr expression.
5130
5133
void collectPossibleCalleesByQualifiedLookup (
5131
5134
DeclContext &DC, Expr *baseExpr, DeclBaseName name,
5132
5135
SmallVectorImpl<FunctionTypeAndDecl> &candidates) {
@@ -5142,6 +5145,7 @@ void collectPossibleCalleesByQualifiedLookup(
5142
5145
collectPossibleCalleesByQualifiedLookup (DC, baseTy, name, candidates);
5143
5146
}
5144
5147
5148
+ // / For the given \c callExpr, collect possible callee types and declarations.
5145
5149
bool collectPossibleCalleesForApply (
5146
5150
DeclContext &DC, ApplyExpr *callExpr,
5147
5151
SmallVectorImpl<FunctionTypeAndDecl> &candidates) {
@@ -5187,6 +5191,8 @@ bool collectPossibleCalleesForApply(
5187
5191
return !candidates.empty ();
5188
5192
}
5189
5193
5194
+ // / For the given \c subscriptExpr, collect possible callee types and
5195
+ // / declarations.
5190
5196
bool collectPossibleCalleesForSubscript (
5191
5197
DeclContext &DC, SubscriptExpr *subscriptExpr,
5192
5198
SmallVectorImpl<FunctionTypeAndDecl> &candidates) {
@@ -5204,6 +5210,9 @@ bool collectPossibleCalleesForSubscript(
5204
5210
return !candidates.empty ();
5205
5211
}
5206
5212
5213
+ // / Get index of \p CCExpr in \p Args. \p Args is usually a \c TupleExpr,
5214
+ // / \c ParenExpr, or a \c TupleShuffleExpr.
5215
+ // / \returns \c true if success, \c false if \p CCExpr is not a part of \p Args.
5207
5216
bool getPositionInArgs (DeclContext &DC, Expr *Args, Expr *CCExpr,
5208
5217
unsigned &Position, bool &HasName) {
5209
5218
if (auto TSE = dyn_cast<TupleShuffleExpr>(Args))
@@ -5287,6 +5296,7 @@ class CodeCompletionTypeContextAnalyzer {
5287
5296
PossibleNames.push_back (name);
5288
5297
}
5289
5298
5299
+ // / Collect context information at call argument position.
5290
5300
bool collectArgumentExpectation (DeclContext &DC, Expr *E, Expr *CCExpr) {
5291
5301
// Collect parameter lists for possible func decls.
5292
5302
SmallVector<FunctionTypeAndDecl, 2 > Candidates;
@@ -5300,7 +5310,7 @@ class CodeCompletionTypeContextAnalyzer {
5300
5310
return false ;
5301
5311
Arg = subscriptExpr->getIndex ();
5302
5312
}
5303
- PossibleCallees.append (Candidates.begin (), Candidates.end ());
5313
+ PossibleCallees.assign (Candidates.begin (), Candidates.end ());
5304
5314
5305
5315
// Determine the position of code completion token in call argument.
5306
5316
unsigned Position;
0 commit comments