@@ -6073,6 +6073,7 @@ parseDeclProtocol(ParseDeclOptions Flags, DeclAttributes &Attributes) {
60736073 SyntaxParsingContext BlockContext (SyntaxContext, SyntaxKind::MemberDeclBlock);
60746074 SourceLoc LBraceLoc;
60756075 SourceLoc RBraceLoc;
6076+ SourceLoc PosBeforeLB = Tok.getLoc ();
60766077 if (parseToken (tok::l_brace, LBraceLoc, diag::expected_lbrace_protocol)) {
60776078 LBraceLoc = PreviousLoc;
60786079 RBraceLoc = LBraceLoc;
@@ -6082,9 +6083,21 @@ parseDeclProtocol(ParseDeclOptions Flags, DeclAttributes &Attributes) {
60826083 ParseDeclOptions Options (PD_HasContainerType |
60836084 PD_DisallowInit |
60846085 PD_InProtocol);
6085- if (parseDeclList (LBraceLoc, RBraceLoc, diag::expected_rbrace_protocol,
6086- Options, [&](Decl *D) {Proto->addMember (D);}))
6087- Status.setIsParseError ();
6086+ if (canDelayMemberDeclParsing ()) {
6087+ if (Tok.is (tok::r_brace)) {
6088+ RBraceLoc = consumeToken ();
6089+ } else {
6090+ RBraceLoc = Tok.getLoc ();
6091+ Status.setIsParseError ();
6092+ }
6093+ State->delayDeclList (Proto, Options.toRaw (), CurDeclContext,
6094+ { LBraceLoc, RBraceLoc },
6095+ PosBeforeLB);
6096+ } else {
6097+ if (parseDeclList (LBraceLoc, RBraceLoc, diag::expected_rbrace_protocol,
6098+ Options, [&](Decl *D) {Proto->addMember (D);}))
6099+ Status.setIsParseError ();
6100+ }
60886101 }
60896102
60906103 // Install the protocol elements.
0 commit comments