@@ -1285,16 +1285,7 @@ ParserResult<Expr> Parser::parseExprPostfix(Diag<> ID, bool isExprBasic) {
1285
1285
continue ;
1286
1286
}
1287
1287
1288
- // Handle "x.<tab>" for code completion.
1289
- if (Tok.is (tok::code_complete)) {
1290
- if (CodeCompletion && Result.isNonNull ())
1291
- CodeCompletion->completeDotExpr (Result.get (), /* DotLoc=*/ TokLoc);
1292
- // Eat the code completion token because we handled it.
1293
- consumeToken (tok::code_complete);
1294
- Result.setHasCodeCompletion ();
1295
- return Result;
1296
- }
1297
-
1288
+
1298
1289
// If we have '.<keyword><code_complete>', try to recover by creating
1299
1290
// an identifier with the same spelling as the keyword.
1300
1291
if (Tok.isKeyword () && peekToken ().is (tok::code_complete)) {
@@ -1304,8 +1295,19 @@ ParserResult<Expr> Parser::parseExprPostfix(Diag<> ID, bool isExprBasic) {
1304
1295
Name, DeclNameLoc (Tok.getLoc ()),
1305
1296
/* Implicit=*/ false ));
1306
1297
consumeToken ();
1298
+ // Fall into the next code completion handler.
1307
1299
}
1308
1300
1301
+ // Handle "x.<tab>" for code completion.
1302
+ if (Tok.is (tok::code_complete)) {
1303
+ if (CodeCompletion && Result.isNonNull ())
1304
+ CodeCompletion->completeDotExpr (Result.get (), /* DotLoc=*/ TokLoc);
1305
+ // Eat the code completion token because we handled it.
1306
+ consumeToken (tok::code_complete);
1307
+ Result.setHasCodeCompletion ();
1308
+ return Result;
1309
+ }
1310
+
1309
1311
// Non-identifier cases.
1310
1312
if (Tok.isNot (tok::identifier, tok::kw_init)) {
1311
1313
checkForInputIncomplete ();
0 commit comments