@@ -1545,7 +1545,7 @@ ParserResult<Expr> Parser::parseExprPrimary(Diag<> ID, bool isExprBasic) {
1545
1545
1546
1546
LLVM_FALLTHROUGH;
1547
1547
case tok::kw_Self: // Self
1548
- return makeParserResult ( parseExprIdentifier () );
1548
+ return parseExprIdentifier ();
1549
1549
1550
1550
case tok::kw_Any: { // Any
1551
1551
ExprContext.setCreateSyntax (SyntaxKind::TypeExpr);
@@ -2192,7 +2192,8 @@ DeclNameRef Parser::parseDeclNameRef(DeclNameLoc &loc,
2192
2192
2193
2193
// / expr-identifier:
2194
2194
// / unqualified-decl-name generic-args?
2195
- Expr *Parser::parseExprIdentifier () {
2195
+ ParserResult<Expr> Parser::parseExprIdentifier () {
2196
+ ParserStatus status;
2196
2197
assert (Tok.isAny (tok::identifier, tok::kw_self, tok::kw_Self));
2197
2198
SyntaxParsingContext IDSyntaxContext (SyntaxContext,
2198
2199
SyntaxKind::IdentifierExpr);
@@ -2217,8 +2218,9 @@ Expr *Parser::parseExprIdentifier() {
2217
2218
if (canParseAsGenericArgumentList ()) {
2218
2219
SyntaxContext->createNodeInPlace (SyntaxKind::IdentifierExpr);
2219
2220
SyntaxContext->setCreateSyntax (SyntaxKind::SpecializeExpr);
2220
- auto argStat = parseGenericArguments (args, LAngleLoc, RAngleLoc);
2221
- if (argStat.isErrorOrHasCompletion ())
2221
+ auto argStatus = parseGenericArguments (args, LAngleLoc, RAngleLoc);
2222
+ status |= argStatus;
2223
+ if (argStatus.isErrorOrHasCompletion ())
2222
2224
diagnose (LAngleLoc, diag::while_parsing_as_left_angle_bracket);
2223
2225
2224
2226
// The result can be empty in error cases.
@@ -2227,7 +2229,8 @@ Expr *Parser::parseExprIdentifier() {
2227
2229
2228
2230
if (name.getBaseName ().isEditorPlaceholder ()) {
2229
2231
IDSyntaxContext.setCreateSyntax (SyntaxKind::EditorPlaceholderExpr);
2230
- return parseExprEditorPlaceholder (IdentTok, name.getBaseIdentifier ());
2232
+ return makeParserResult (
2233
+ status, parseExprEditorPlaceholder (IdentTok, name.getBaseIdentifier ()));
2231
2234
}
2232
2235
2233
2236
auto refKind = DeclRefKind::Ordinary;
@@ -2237,7 +2240,7 @@ Expr *Parser::parseExprIdentifier() {
2237
2240
E = UnresolvedSpecializeExpr::create (Context, E, LAngleLoc, args,
2238
2241
RAngleLoc);
2239
2242
}
2240
- return E ;
2243
+ return makeParserResult (status, E) ;
2241
2244
}
2242
2245
2243
2246
Expr *Parser::parseExprEditorPlaceholder (Token PlaceholderTok,
@@ -2508,7 +2511,9 @@ ParserStatus Parser::parseClosureSignatureIfPresent(
2508
2511
// If this is the simple case, then the identifier is both the name and
2509
2512
// the expression to capture.
2510
2513
name = Context.getIdentifier (Tok.getText ());
2511
- initializer = parseExprIdentifier ();
2514
+ auto initializerResult = parseExprIdentifier ();
2515
+ status |= initializerResult;
2516
+ initializer = initializerResult.get ();
2512
2517
2513
2518
// It is a common error to try to capture a nested field instead of just
2514
2519
// a local name, reject it with a specific error message.
0 commit comments