@@ -204,7 +204,7 @@ ParserResult<TypeRepr> Parser::parseTypeSimple(
204
204
status, PackTypeRepr::create (Context, keywordLoc,
205
205
SourceRange (lbLoc, rbLoc), elements));
206
206
} else {
207
- ty = parseSimpleTypeIdentifier ();
207
+ ty = parseTypeIdentifier ();
208
208
if (auto *ITR = cast_or_null<IdentTypeRepr>(ty.getPtrOrNull ())) {
209
209
if (Tok.is (tok::code_complete) && !Tok.isAtStartOfLine ()) {
210
210
if (IDECallbacks)
@@ -716,16 +716,8 @@ ParserStatus Parser::parseGenericArguments(SmallVectorImpl<TypeRepr *> &Args,
716
716
return makeParserSuccess ();
717
717
}
718
718
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 ())
729
721
return makeParserError ();
730
722
731
723
if (Tok.isNot (tok::identifier) && Tok.isNot (tok::kw_Self)) {
@@ -750,38 +742,11 @@ Parser::parseTypeIdentifier(bool isParsingQualifiedDeclBaseType) {
750
742
return nullptr ;
751
743
}
752
744
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
-
780
745
ParserStatus Status;
781
746
SmallVector<IdentTypeRepr *, 4 > ComponentsR;
782
747
SourceLoc EndLoc;
783
748
while (true ) {
784
- auto IdentResult = parseSimpleTypeIdentifier ();
749
+ auto IdentResult = parseTypeIdentifier ();
785
750
if (IdentResult.isParseErrorOrHasCompletion ())
786
751
return IdentResult;
787
752
@@ -797,9 +762,10 @@ Parser::parseTypeIdentifier(bool isParsingQualifiedDeclBaseType) {
797
762
if (peekToken ().isContextualKeyword (" Type" ) ||
798
763
peekToken ().isContextualKeyword (" Protocol" ))
799
764
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
+ {
803
769
// If qualified name base type cannot be parsed from the current
804
770
// point (i.e. the next type identifier is not followed by a '.'),
805
771
// then the next identifier is the final declaration name component.
@@ -839,7 +805,7 @@ Parser::parseTypeIdentifier(bool isParsingQualifiedDeclBaseType) {
839
805
return makeParserResult (Status, DeclRefTR);
840
806
}
841
807
842
- ParserResult<IdentTypeRepr> Parser::parseSimpleTypeIdentifier () {
808
+ ParserResult<IdentTypeRepr> Parser::parseTypeIdentifier () {
843
809
// FIXME: We should parse e.g. 'X.var'. Almost any keyword is a valid member
844
810
// component.
845
811
DeclNameLoc Loc;
@@ -901,7 +867,7 @@ ParserResult<TypeRepr> Parser::parseTypeDotted(ParserResult<TypeRepr> Base) {
901
867
continue ;
902
868
}
903
869
904
- auto IdentResult = parseSimpleTypeIdentifier ();
870
+ auto IdentResult = parseTypeIdentifier ();
905
871
if (IdentResult.isParseErrorOrHasCompletion ())
906
872
return IdentResult | ParserStatus (Base);
907
873
0 commit comments