@@ -874,69 +874,11 @@ extension Parser.Lookahead {
874874}
875875
876876extension Parser {
877- private mutating func parseLifetimeTypeSpecifier( ) -> RawTypeSpecifierListSyntax . Element {
878- let ( unexpectedBeforeDependsOnKeyword, dependsOnKeyword) = self . expect ( . keyword( . dependsOn) )
879-
880- guard let leftParen = self . consume ( if: . leftParen) else {
881- // If there is no left paren, add an entirely missing detail. Otherwise, we start to consume the following type
882- // name as a token inside the detail, which leads to confusing recovery results.
883- let lifetimeSpecifierArgumentList = RawLifetimeSpecifierArgumentListSyntax (
884- elements: [
885- RawLifetimeSpecifierArgumentSyntax ( parameter: missingToken ( . identifier) , trailingComma: nil , arena: arena)
886- ] ,
887- arena: self . arena
888- )
889- let lifetimeSpecifier = RawLifetimeTypeSpecifierSyntax (
890- unexpectedBeforeDependsOnKeyword,
891- dependsOnKeyword: dependsOnKeyword,
892- leftParen: missingToken ( . leftParen) ,
893- scopedKeyword: nil ,
894- arguments: lifetimeSpecifierArgumentList,
895- rightParen: missingToken ( . rightParen) ,
896- arena: self . arena
897- )
898- return . lifetimeTypeSpecifier( lifetimeSpecifier)
899- }
900-
901- let scoped = self . consume ( if: . keyword( . scoped) )
902- var keepGoing : RawTokenSyntax ?
903- var arguments : [ RawLifetimeSpecifierArgumentSyntax ] = [ ]
904- var loopProgress = LoopProgressCondition ( )
905- repeat {
906- let ( unexpectedBeforeParameter, parameter) = self . expect (
907- anyIn: LifetimeSpecifierArgumentSyntax . ParameterOptions. self,
908- default: . identifier
909- )
910- keepGoing = self . consume ( if: . comma)
911- arguments. append (
912- RawLifetimeSpecifierArgumentSyntax (
913- unexpectedBeforeParameter,
914- parameter: parameter,
915- trailingComma: keepGoing,
916- arena: arena
917- )
918- )
919- } while keepGoing != nil && self . hasProgressed ( & loopProgress)
920- let lifetimeSpecifierArgumentList = RawLifetimeSpecifierArgumentListSyntax ( elements: arguments, arena: self . arena)
921- let ( unexpectedBeforeRightParen, rightParen) = self . expect ( . rightParen)
922- let lifetimeSpecifier = RawLifetimeTypeSpecifierSyntax (
923- unexpectedBeforeDependsOnKeyword,
924- dependsOnKeyword: dependsOnKeyword,
925- leftParen: leftParen,
926- scopedKeyword: scoped,
927- arguments: lifetimeSpecifierArgumentList,
928- unexpectedBeforeRightParen,
929- rightParen: rightParen,
930- arena: self . arena
931- )
932- return . lifetimeTypeSpecifier( lifetimeSpecifier)
933- }
934-
935877 private mutating func parseSimpleTypeSpecifier(
936878 specifierHandle: TokenConsumptionHandle
937- ) -> RawTypeSpecifierListSyntax . Element {
879+ ) -> RawSimpleTypeSpecifierSyntax {
938880 let specifier = self . eat ( specifierHandle)
939- return . simpleTypeSpecifier ( RawSimpleTypeSpecifierSyntax ( specifier: specifier, arena: arena) )
881+ return RawSimpleTypeSpecifierSyntax ( specifier: specifier, arena: arena)
940882 }
941883
942884 mutating func parseTypeAttributeList(
@@ -945,26 +887,18 @@ extension Parser {
945887 specifiers: RawTypeSpecifierListSyntax ,
946888 attributes: RawAttributeListSyntax
947889 ) ? {
948- var specifiers : [ RawTypeSpecifierListSyntax . Element ] = [ ]
890+ var specifiers : [ RawSimpleTypeSpecifierSyntax ] = [ ]
949891 SPECIFIER_PARSING: while canHaveParameterSpecifier {
950892 if let ( _, specifierHandle) = self . at ( anyIn: SimpleTypeSpecifierSyntax . SpecifierOptions. self) {
951893 specifiers. append ( parseSimpleTypeSpecifier ( specifierHandle: specifierHandle) )
952- } else if self . at ( . keyword( . dependsOn) ) {
953- if self . experimentalFeatures. contains ( . nonescapableTypes) {
954- specifiers. append ( parseLifetimeTypeSpecifier ( ) )
955- } else {
956- break SPECIFIER_PARSING
957- }
958894 } else {
959895 break SPECIFIER_PARSING
960896 }
961897 }
962898 specifiers += misplacedSpecifiers. map {
963- . simpleTypeSpecifier(
964- RawSimpleTypeSpecifierSyntax (
965- specifier: missingToken ( $0. tokenKind, text: $0. tokenText) ,
966- arena: arena
967- )
899+ RawSimpleTypeSpecifierSyntax (
900+ specifier: missingToken ( $0. tokenKind, text: $0. tokenText) ,
901+ arena: arena
968902 )
969903 }
970904
0 commit comments