@@ -668,19 +668,9 @@ ParserResult<Expr> Parser::parseExprSelector() {
668
668
}
669
669
670
670
// If the subexpression was in error, just propagate the error.
671
- if (subExpr.isParseError ()) {
672
- if (subExpr.hasCodeCompletion ()) {
673
- auto res = makeParserResult (
674
- new (Context) ObjCSelectorExpr (selectorKind, keywordLoc,
675
- lParenLoc, modifierLoc,
676
- subExpr.get (), rParenLoc));
677
- res.setHasCodeCompletion ();
678
- return res;
679
- } else {
680
- return makeParserResult<Expr>(
681
- new (Context) ErrorExpr (SourceRange (keywordLoc, rParenLoc)));
682
- }
683
- }
671
+ if (subExpr.isParseError ())
672
+ return makeParserResult<Expr>(
673
+ new (Context) ErrorExpr (SourceRange (keywordLoc, rParenLoc)));
684
674
685
675
return makeParserResult<Expr>(
686
676
new (Context) ObjCSelectorExpr (selectorKind, keywordLoc, lParenLoc,
@@ -3130,26 +3120,16 @@ ParserResult<Expr> Parser::parseExprTypeOf() {
3130
3120
if (Tok.is (tok::r_paren))
3131
3121
rParenLoc = consumeToken ();
3132
3122
else
3133
- rParenLoc = Tok. getLoc () ;
3123
+ rParenLoc = PreviousLoc ;
3134
3124
} else {
3135
3125
parseMatchingToken (tok::r_paren, rParenLoc,
3136
3126
diag::expr_typeof_expected_rparen, lParenLoc);
3137
3127
}
3138
3128
3139
3129
// If the subexpression was in error, just propagate the error.
3140
- if (subExpr.isParseError ()) {
3141
- if (subExpr.hasCodeCompletion ()) {
3142
- auto res = makeParserResult (
3143
- new (Context) DynamicTypeExpr (keywordLoc, lParenLoc,
3144
- subExpr.get (), rParenLoc,
3145
- Type ()));
3146
- res.setHasCodeCompletion ();
3147
- return res;
3148
- } else {
3149
- return makeParserResult<Expr>(
3150
- new (Context) ErrorExpr (SourceRange (keywordLoc, rParenLoc)));
3151
- }
3152
- }
3130
+ if (subExpr.isParseError ())
3131
+ return makeParserResult<Expr>(
3132
+ new (Context) ErrorExpr (SourceRange (keywordLoc, rParenLoc)));
3153
3133
3154
3134
return makeParserResult (
3155
3135
new (Context) DynamicTypeExpr (keywordLoc, lParenLoc,
0 commit comments