Skip to content

Commit 7035da2

Browse files
committed
fix a refactoro that I introduced in 561c379 that broke IDE/complete_at_top_level.swift.
1 parent 561c379 commit 7035da2

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lib/Parse/ParseExpr.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,16 +1285,7 @@ ParserResult<Expr> Parser::parseExprPostfix(Diag<> ID, bool isExprBasic) {
12851285
continue;
12861286
}
12871287

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+
12981289
// If we have '.<keyword><code_complete>', try to recover by creating
12991290
// an identifier with the same spelling as the keyword.
13001291
if (Tok.isKeyword() && peekToken().is(tok::code_complete)) {
@@ -1304,8 +1295,19 @@ ParserResult<Expr> Parser::parseExprPostfix(Diag<> ID, bool isExprBasic) {
13041295
Name, DeclNameLoc(Tok.getLoc()),
13051296
/*Implicit=*/false));
13061297
consumeToken();
1298+
// Fall into the next code completion handler.
13071299
}
13081300

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+
13091311
// Non-identifier cases.
13101312
if (Tok.isNot(tok::identifier, tok::kw_init)) {
13111313
checkForInputIncomplete();

0 commit comments

Comments
 (0)