@@ -4973,6 +4973,7 @@ namespace {
4973
4973
namespace {
4974
4974
using FunctionTypeAndDecl = std::pair<AnyFunctionType *, ValueDecl *>;
4975
4975
4976
+ // / Collect function (or subscript) members with the given \p name on \p baseTy.
4976
4977
void collectPossibleCalleesByQualifiedLookup (
4977
4978
DeclContext &DC, Type baseTy, DeclBaseName name,
4978
4979
SmallVectorImpl<FunctionTypeAndDecl> &candidates) {
@@ -5005,6 +5006,8 @@ void collectPossibleCalleesByQualifiedLookup(
5005
5006
}
5006
5007
}
5007
5008
5009
+ // / Collect function (or subscript) members with the given \p name on
5010
+ // / \p baseExpr expression.
5008
5011
void collectPossibleCalleesByQualifiedLookup (
5009
5012
DeclContext &DC, Expr *baseExpr, DeclBaseName name,
5010
5013
SmallVectorImpl<FunctionTypeAndDecl> &candidates) {
@@ -5020,6 +5023,7 @@ void collectPossibleCalleesByQualifiedLookup(
5020
5023
collectPossibleCalleesByQualifiedLookup (DC, baseTy, name, candidates);
5021
5024
}
5022
5025
5026
+ // / For the given \c callExpr, collect possible callee types and declarations.
5023
5027
bool collectPossibleCalleesForApply (
5024
5028
DeclContext &DC, ApplyExpr *callExpr,
5025
5029
SmallVectorImpl<FunctionTypeAndDecl> &candidates) {
@@ -5065,6 +5069,8 @@ bool collectPossibleCalleesForApply(
5065
5069
return !candidates.empty ();
5066
5070
}
5067
5071
5072
+ // / For the given \c subscriptExpr, collect possible callee types and
5073
+ // / declarations.
5068
5074
bool collectPossibleCalleesForSubscript (
5069
5075
DeclContext &DC, SubscriptExpr *subscriptExpr,
5070
5076
SmallVectorImpl<FunctionTypeAndDecl> &candidates) {
@@ -5082,6 +5088,9 @@ bool collectPossibleCalleesForSubscript(
5082
5088
return !candidates.empty ();
5083
5089
}
5084
5090
5091
+ // / Get index of \p CCExpr in \p Args. \p Args is usually a \c TupleExpr,
5092
+ // / \c ParenExpr, or a \c TupleShuffleExpr.
5093
+ // / \returns \c true if success, \c false if \p CCExpr is not a part of \p Args.
5085
5094
bool getPositionInArgs (DeclContext &DC, Expr *Args, Expr *CCExpr,
5086
5095
unsigned &Position, bool &HasName) {
5087
5096
if (auto TSE = dyn_cast<TupleShuffleExpr>(Args))
@@ -5165,6 +5174,7 @@ class CodeCompletionTypeContextAnalyzer {
5165
5174
PossibleNames.push_back (name);
5166
5175
}
5167
5176
5177
+ // / Collect context information at call argument position.
5168
5178
bool collectArgumentExpectation (DeclContext &DC, Expr *E, Expr *CCExpr) {
5169
5179
// Collect parameter lists for possible func decls.
5170
5180
SmallVector<FunctionTypeAndDecl, 2 > Candidates;
@@ -5178,7 +5188,7 @@ class CodeCompletionTypeContextAnalyzer {
5178
5188
return false ;
5179
5189
Arg = subscriptExpr->getIndex ();
5180
5190
}
5181
- PossibleCallees.append (Candidates.begin (), Candidates.end ());
5191
+ PossibleCallees.assign (Candidates.begin (), Candidates.end ());
5182
5192
5183
5193
// Determine the position of code completion token in call argument.
5184
5194
unsigned Position;
0 commit comments