@@ -1545,7 +1545,7 @@ ParserResult<Expr> Parser::parseExprPrimary(Diag<> ID, bool isExprBasic) {
15451545
15461546 LLVM_FALLTHROUGH;
15471547 case tok::kw_Self: // Self
1548- return makeParserResult ( parseExprIdentifier () );
1548+ return parseExprIdentifier ();
15491549
15501550 case tok::kw_Any: { // Any
15511551 ExprContext.setCreateSyntax (SyntaxKind::TypeExpr);
@@ -2192,7 +2192,8 @@ DeclNameRef Parser::parseDeclNameRef(DeclNameLoc &loc,
21922192
21932193// / expr-identifier:
21942194// / unqualified-decl-name generic-args?
2195- Expr *Parser::parseExprIdentifier () {
2195+ ParserResult<Expr> Parser::parseExprIdentifier () {
2196+ ParserStatus status;
21962197 assert (Tok.isAny (tok::identifier, tok::kw_self, tok::kw_Self));
21972198 SyntaxParsingContext IDSyntaxContext (SyntaxContext,
21982199 SyntaxKind::IdentifierExpr);
@@ -2217,8 +2218,9 @@ Expr *Parser::parseExprIdentifier() {
22172218 if (canParseAsGenericArgumentList ()) {
22182219 SyntaxContext->createNodeInPlace (SyntaxKind::IdentifierExpr);
22192220 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 ())
22222224 diagnose (LAngleLoc, diag::while_parsing_as_left_angle_bracket);
22232225
22242226 // The result can be empty in error cases.
@@ -2227,7 +2229,8 @@ Expr *Parser::parseExprIdentifier() {
22272229
22282230 if (name.getBaseName ().isEditorPlaceholder ()) {
22292231 IDSyntaxContext.setCreateSyntax (SyntaxKind::EditorPlaceholderExpr);
2230- return parseExprEditorPlaceholder (IdentTok, name.getBaseIdentifier ());
2232+ return makeParserResult (
2233+ status, parseExprEditorPlaceholder (IdentTok, name.getBaseIdentifier ()));
22312234 }
22322235
22332236 auto refKind = DeclRefKind::Ordinary;
@@ -2237,7 +2240,7 @@ Expr *Parser::parseExprIdentifier() {
22372240 E = UnresolvedSpecializeExpr::create (Context, E, LAngleLoc, args,
22382241 RAngleLoc);
22392242 }
2240- return E ;
2243+ return makeParserResult (status, E) ;
22412244}
22422245
22432246Expr *Parser::parseExprEditorPlaceholder (Token PlaceholderTok,
@@ -2508,7 +2511,9 @@ ParserStatus Parser::parseClosureSignatureIfPresent(
25082511 // If this is the simple case, then the identifier is both the name and
25092512 // the expression to capture.
25102513 name = Context.getIdentifier (Tok.getText ());
2511- initializer = parseExprIdentifier ();
2514+ auto initializerResult = parseExprIdentifier ();
2515+ status |= initializerResult;
2516+ initializer = initializerResult.get ();
25122517
25132518 // It is a common error to try to capture a nested field instead of just
25142519 // a local name, reject it with a specific error message.
0 commit comments