@@ -4906,7 +4906,7 @@ static void addConditionalCompilationFlags(ASTContext &Ctx,
4906
4906
4907
4907
namespace {
4908
4908
class ExprParentFinder : public ASTWalker {
4909
- friend class CodeCompletionTypeContextAnalyzer ;
4909
+ friend class ExprContextAnalyzer ;
4910
4910
Expr *ChildExpr;
4911
4911
llvm::function_ref<bool (ParentTy, ParentTy)> Predicate;
4912
4912
@@ -5161,7 +5161,7 @@ bool translateArgIndexToParamIndex(Expr *Args, unsigned &Position,
5161
5161
5162
5162
// / Given an expression and its context, the analyzer tries to figure out the
5163
5163
// / expected type of the expression by analyzing its context.
5164
- class CodeCompletionTypeContextAnalyzer {
5164
+ class ExprContextAnalyzer {
5165
5165
DeclContext *DC;
5166
5166
Expr *ParsedExpr;
5167
5167
SourceManager &SM;
@@ -5239,7 +5239,7 @@ class CodeCompletionTypeContextAnalyzer {
5239
5239
}
5240
5240
5241
5241
public:
5242
- CodeCompletionTypeContextAnalyzer (DeclContext *DC, Expr *ParsedExpr) : DC(DC),
5242
+ ExprContextAnalyzer (DeclContext *DC, Expr *ParsedExpr) : DC(DC),
5243
5243
ParsedExpr (ParsedExpr), SM(DC->getASTContext ().SourceMgr),
5244
5244
Context(DC->getASTContext ()),
5245
5245
Finder(ParsedExpr, [](ASTWalker::ParentTy Node, ASTWalker::ParentTy Parent) {
@@ -5542,8 +5542,7 @@ void CodeCompletionCallbacksImpl::doneParsing() {
5542
5542
if (isa<BindOptionalExpr>(ParsedExpr) || isa<ForceValueExpr>(ParsedExpr))
5543
5543
Lookup.setIsUnwrappedOptional (true );
5544
5544
5545
- ::CodeCompletionTypeContextAnalyzer TypeAnalyzer (CurDeclContext,
5546
- ParsedExpr);
5545
+ ::ExprContextAnalyzer TypeAnalyzer (CurDeclContext, ParsedExpr);
5547
5546
if (TypeAnalyzer.Analyze ()) {
5548
5547
Lookup.setExpectedTypes (TypeAnalyzer.getPossibleTypes ());
5549
5548
}
@@ -5586,8 +5585,7 @@ void CodeCompletionCallbacksImpl::doneParsing() {
5586
5585
5587
5586
case CompletionKind::ForEachSequence:
5588
5587
case CompletionKind::PostfixExprBeginning: {
5589
- ::CodeCompletionTypeContextAnalyzer Analyzer (CurDeclContext,
5590
- CodeCompleteTokenExpr);
5588
+ ::ExprContextAnalyzer Analyzer (CurDeclContext, CodeCompleteTokenExpr);
5591
5589
if (Analyzer.Analyze ()) {
5592
5590
Lookup.setExpectedTypes (Analyzer.getPossibleTypes ());
5593
5591
}
@@ -5613,8 +5611,7 @@ void CodeCompletionCallbacksImpl::doneParsing() {
5613
5611
case CompletionKind::PostfixExprParen: {
5614
5612
Lookup.setHaveLParen (true );
5615
5613
5616
- ::CodeCompletionTypeContextAnalyzer TypeAnalyzer (CurDeclContext,
5617
- CodeCompleteTokenExpr);
5614
+ ::ExprContextAnalyzer TypeAnalyzer (CurDeclContext, CodeCompleteTokenExpr);
5618
5615
if (TypeAnalyzer.Analyze ()) {
5619
5616
Lookup.setExpectedTypes (TypeAnalyzer.getPossibleTypes ());
5620
5617
}
@@ -5738,8 +5735,7 @@ void CodeCompletionCallbacksImpl::doneParsing() {
5738
5735
}
5739
5736
case CompletionKind::UnresolvedMember: {
5740
5737
Lookup.setHaveDot (DotLoc);
5741
- ::CodeCompletionTypeContextAnalyzer TypeAnalyzer (CurDeclContext,
5742
- CodeCompleteTokenExpr);
5738
+ ::ExprContextAnalyzer TypeAnalyzer (CurDeclContext, CodeCompleteTokenExpr);
5743
5739
if (TypeAnalyzer.Analyze ())
5744
5740
Lookup.setExpectedTypes (TypeAnalyzer.getPossibleTypes ());
5745
5741
Lookup.getUnresolvedMemberCompletions (TypeAnalyzer.getPossibleTypes ());
@@ -5753,8 +5749,7 @@ void CodeCompletionCallbacksImpl::doneParsing() {
5753
5749
break ;
5754
5750
}
5755
5751
case CompletionKind::CallArg : {
5756
- ::CodeCompletionTypeContextAnalyzer Analyzer (CurDeclContext,
5757
- CodeCompleteTokenExpr);
5752
+ ::ExprContextAnalyzer Analyzer (CurDeclContext, CodeCompleteTokenExpr);
5758
5753
Analyzer.Analyze ();
5759
5754
if (!Analyzer.getPossibleNames ().empty ()) {
5760
5755
Lookup.addArgNameCompletionResults (Analyzer.getPossibleNames ());
0 commit comments