File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -838,6 +838,27 @@ NullablePtr<Expr> Parser::parseExprPostfix(Diag<> ID) {
838
838
}
839
839
if (consumeIf (tok::period) || (IsPeriod && consumeIf (tok::period_prefix))) {
840
840
if (Tok.isNot (tok::identifier) && Tok.isNot (tok::integer_literal)) {
841
+ if (peekToken ().is (tok::code_complete)) {
842
+ switch (Tok.getKind ()) {
843
+ default :
844
+ break ;
845
+
846
+ #define KEYWORD (kw ) \
847
+ case tok::kw_##kw:
848
+ #include " swift/Parse/Tokens.def"
849
+ {
850
+ // If we have a '.<keyword><code_complete>', then try to recover
851
+ // by creating an identifier with the same spelling as the
852
+ // keyword.
853
+ Identifier Name = Context.getIdentifier (Tok.getText ());
854
+ Result = new (Context) UnresolvedDotExpr (Result.get (), TokLoc,
855
+ Name, Tok.getLoc ());
856
+ consumeToken ();
857
+ }
858
+ break ;
859
+ }
860
+ }
861
+
841
862
if (Tok.is (tok::code_complete) && CodeCompletion && Result.isNonNull ()) {
842
863
CodeCompletion->completeDotExpr (Result.get ());
843
864
return nullptr ;
You can’t perform that action at this time.
0 commit comments