@@ -204,7 +204,7 @@ ParserResult<TypeRepr> Parser::parseTypeSimple(
204204 status, PackTypeRepr::create (Context, keywordLoc,
205205 SourceRange (lbLoc, rbLoc), elements));
206206 } else {
207- ty = parseSimpleTypeIdentifier ();
207+ ty = parseTypeIdentifier ();
208208 if (auto *ITR = cast_or_null<IdentTypeRepr>(ty.getPtrOrNull ())) {
209209 if (Tok.is (tok::code_complete) && !Tok.isAtStartOfLine ()) {
210210 if (IDECallbacks)
@@ -716,16 +716,8 @@ ParserStatus Parser::parseGenericArguments(SmallVectorImpl<TypeRepr *> &Args,
716716 return makeParserSuccess ();
717717}
718718
719- // / parseTypeIdentifier
720- // /
721- // / type-identifier:
722- // / identifier generic-args? ('.' identifier generic-args?)*
723- // /
724- ParserResult<TypeRepr>
725- Parser::parseTypeIdentifier (bool isParsingQualifiedDeclBaseType) {
726- // If parsing a qualified declaration name, return error if base type cannot
727- // be parsed.
728- if (isParsingQualifiedDeclBaseType && !canParseBaseTypeForQualifiedDeclName ())
719+ ParserResult<TypeRepr> Parser::parseQualifiedDeclNameBaseType () {
720+ if (!canParseBaseTypeForQualifiedDeclName ())
729721 return makeParserError ();
730722
731723 if (Tok.isNot (tok::identifier) && Tok.isNot (tok::kw_Self)) {
@@ -750,38 +742,11 @@ Parser::parseTypeIdentifier(bool isParsingQualifiedDeclBaseType) {
750742 return nullptr ;
751743 }
752744
753- // In SIL files (not just when parsing SIL types), accept the
754- // Pack{} syntax for spelling variadic type packs.
755- if (SIL && Tok.isContextualKeyword (" Pack" ) &&
756- peekToken ().is (tok::l_brace)) {
757- TokReceiver->registerTokenKindChange (Tok.getLoc (), tok::contextual_keyword);
758- SourceLoc keywordLoc = consumeToken (tok::identifier);
759- SourceLoc lbLoc = consumeToken (tok::l_brace);
760- SourceLoc rbLoc;
761- SmallVector<TypeRepr*, 8 > elements;
762- auto status = parseList (tok::r_brace, lbLoc, rbLoc,
763- /* AllowSepAfterLast=*/ false ,
764- diag::expected_rbrace_pack_type_list,
765- [&] () -> ParserStatus {
766- auto element = parseType (diag::expected_type);
767- if (element.hasCodeCompletion ())
768- return makeParserCodeCompletionStatus ();
769- if (element.isNull ())
770- return makeParserError ();
771- elements.push_back (element.get ());
772- return makeParserSuccess ();
773- });
774-
775- return makeParserResult (status,
776- PackTypeRepr::create (Context, keywordLoc, SourceRange (lbLoc, rbLoc),
777- elements));
778- }
779-
780745 ParserStatus Status;
781746 SmallVector<IdentTypeRepr *, 4 > ComponentsR;
782747 SourceLoc EndLoc;
783748 while (true ) {
784- auto IdentResult = parseSimpleTypeIdentifier ();
749+ auto IdentResult = parseTypeIdentifier ();
785750 if (IdentResult.isParseErrorOrHasCompletion ())
786751 return IdentResult;
787752
@@ -797,9 +762,10 @@ Parser::parseTypeIdentifier(bool isParsingQualifiedDeclBaseType) {
797762 if (peekToken ().isContextualKeyword (" Type" ) ||
798763 peekToken ().isContextualKeyword (" Protocol" ))
799764 break ;
800- // If parsing a qualified declaration name, break before parsing the
801- // period before the final declaration name component.
802- if (isParsingQualifiedDeclBaseType) {
765+
766+ // Break before parsing the period before the final declaration
767+ // name component.
768+ {
803769 // If qualified name base type cannot be parsed from the current
804770 // point (i.e. the next type identifier is not followed by a '.'),
805771 // then the next identifier is the final declaration name component.
@@ -839,7 +805,7 @@ Parser::parseTypeIdentifier(bool isParsingQualifiedDeclBaseType) {
839805 return makeParserResult (Status, DeclRefTR);
840806}
841807
842- ParserResult<IdentTypeRepr> Parser::parseSimpleTypeIdentifier () {
808+ ParserResult<IdentTypeRepr> Parser::parseTypeIdentifier () {
843809 // FIXME: We should parse e.g. 'X.var'. Almost any keyword is a valid member
844810 // component.
845811 DeclNameLoc Loc;
@@ -901,7 +867,7 @@ ParserResult<TypeRepr> Parser::parseTypeDotted(ParserResult<TypeRepr> Base) {
901867 continue ;
902868 }
903869
904- auto IdentResult = parseSimpleTypeIdentifier ();
870+ auto IdentResult = parseTypeIdentifier ();
905871 if (IdentResult.isParseErrorOrHasCompletion ())
906872 return IdentResult | ParserStatus (Base);
907873
0 commit comments