@@ -5184,25 +5184,27 @@ class ExprContextAnalyzer {
5184
5184
}
5185
5185
5186
5186
// / Collect context information at call argument position.
5187
- bool collectArgumentExpectation (DeclContext &DC, Expr *E, Expr *CCExpr ) {
5187
+ bool analyzeApplyExpr ( Expr *E) {
5188
5188
// Collect parameter lists for possible func decls.
5189
5189
SmallVector<FunctionTypeAndDecl, 2 > Candidates;
5190
5190
Expr *Arg = nullptr ;
5191
5191
if (auto *applyExpr = dyn_cast<ApplyExpr>(E)) {
5192
- if (!collectPossibleCalleesForApply (DC, applyExpr, Candidates))
5192
+ if (!collectPossibleCalleesForApply (* DC, applyExpr, Candidates))
5193
5193
return false ;
5194
5194
Arg = applyExpr->getArg ();
5195
5195
} else if (auto *subscriptExpr = dyn_cast<SubscriptExpr>(E)) {
5196
- if (!collectPossibleCalleesForSubscript (DC, subscriptExpr, Candidates))
5196
+ if (!collectPossibleCalleesForSubscript (* DC, subscriptExpr, Candidates))
5197
5197
return false ;
5198
5198
Arg = subscriptExpr->getIndex ();
5199
+ } else {
5200
+ llvm_unreachable (" unexpected expression kind" );
5199
5201
}
5200
5202
PossibleCallees.assign (Candidates.begin (), Candidates.end ());
5201
5203
5202
5204
// Determine the position of code completion token in call argument.
5203
5205
unsigned Position;
5204
5206
bool HasName;
5205
- if (!getPositionInArgs (DC, Arg, CCExpr , Position, HasName))
5207
+ if (!getPositionInArgs (* DC, Arg, ParsedExpr , Position, HasName))
5206
5208
return false ;
5207
5209
if (!translateArgIndexToParamIndex (Arg, Position, HasName))
5208
5210
return false ;
@@ -5243,11 +5245,10 @@ class ExprContextAnalyzer {
5243
5245
case ExprKind::Subscript:
5244
5246
case ExprKind::Binary:
5245
5247
case ExprKind::PrefixUnary: {
5246
- collectArgumentExpectation (*DC, Parent, ParsedExpr );
5248
+ analyzeApplyExpr ( Parent);
5247
5249
break ;
5248
5250
}
5249
5251
case ExprKind::Assign: {
5250
- auto &SM = DC->getASTContext ().SourceMgr ;
5251
5252
auto *AE = cast<AssignExpr>(Parent);
5252
5253
5253
5254
// Make sure code completion is on the right hand side.
0 commit comments