@@ -901,25 +901,23 @@ extension Parser.Lookahead {
901
901
902
902
extension Parser {
903
903
private mutating func parseLifetimeTypeSpecifier( ) -> RawTypeSpecifierListSyntax . Element {
904
- let specifier = self . eat ( TokenSpec ( . dependsOn) )
904
+ let ( unexpectedBeforeDependsOnKeyword , dependsOnKeyword ) = self . expect ( . keyword ( . dependsOn) )
905
905
906
906
guard let leftParen = self . consume ( if: . leftParen) else {
907
907
// If there is no left paren, add an entirely missing detail. Otherwise, we start to consume the following type
908
908
// name as a token inside the detail, which leads to confusing recovery results.
909
- let arguments = RawLifetimeSpecifierArgumentsSyntax (
910
- arguments: RawLifetimeSpecifierArgumentListSyntax (
911
- elements: [
912
- RawLifetimeSpecifierArgumentSyntax ( parameter: missingToken ( . identifier) , trailingComma: nil , arena: arena)
913
- ] ,
914
- arena: self . arena
915
- ) ,
909
+ let lifetimeSpecifierArgumentList = RawLifetimeSpecifierArgumentListSyntax (
910
+ elements: [
911
+ RawLifetimeSpecifierArgumentSyntax ( parameter: missingToken ( . identifier) , trailingComma: nil , arena: arena)
912
+ ] ,
916
913
arena: self . arena
917
914
)
918
915
let lifetimeSpecifier = RawLifetimeTypeSpecifierSyntax (
919
- dependsOnKeyword: specifier,
916
+ unexpectedBeforeDependsOnKeyword,
917
+ dependsOnKeyword: dependsOnKeyword,
920
918
leftParen: missingToken ( . leftParen) ,
921
919
scopedKeyword: nil ,
922
- arguments: arguments ,
920
+ arguments: lifetimeSpecifierArgumentList ,
923
921
rightParen: missingToken ( . rightParen) ,
924
922
arena: self . arena
925
923
)
@@ -947,15 +945,12 @@ extension Parser {
947
945
} while keepGoing != nil && self . hasProgressed ( & loopProgress)
948
946
let lifetimeSpecifierArgumentList = RawLifetimeSpecifierArgumentListSyntax ( elements: arguments, arena: self . arena)
949
947
let ( unexpectedBeforeRightParen, rightParen) = self . expect ( . rightParen)
950
- let argumentsSyntax = RawLifetimeSpecifierArgumentsSyntax (
951
- arguments: lifetimeSpecifierArgumentList,
952
- arena: self . arena
953
- )
954
948
let lifetimeSpecifier = RawLifetimeTypeSpecifierSyntax (
955
- dependsOnKeyword: specifier,
949
+ unexpectedBeforeDependsOnKeyword,
950
+ dependsOnKeyword: dependsOnKeyword,
956
951
leftParen: leftParen,
957
952
scopedKeyword: scoped,
958
- arguments: argumentsSyntax ,
953
+ arguments: lifetimeSpecifierArgumentList ,
959
954
unexpectedBeforeRightParen,
960
955
rightParen: rightParen,
961
956
arena: self . arena
@@ -981,7 +976,7 @@ extension Parser {
981
976
SPECIFIER_PARSING: while canHaveParameterSpecifier {
982
977
if let ( _, specifierHandle) = self . at ( anyIn: SimpleTypeSpecifierSyntax . SpecifierOptions. self) {
983
978
specifiers. append ( parseSimpleTypeSpecifier ( specifierHandle: specifierHandle) )
984
- } else if self . at ( TokenSpec ( . dependsOn) ) {
979
+ } else if self . at ( . keyword ( . dependsOn) ) {
985
980
if self . experimentalFeatures. contains ( . nonescapableTypes) {
986
981
specifiers. append ( parseLifetimeTypeSpecifier ( ) )
987
982
} else {
0 commit comments