@@ -874,69 +874,11 @@ extension Parser.Lookahead {
874
874
}
875
875
876
876
extension 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
-
935
877
private mutating func parseSimpleTypeSpecifier(
936
878
specifierHandle: TokenConsumptionHandle
937
- ) -> RawTypeSpecifierListSyntax . Element {
879
+ ) -> RawSimpleTypeSpecifierSyntax {
938
880
let specifier = self . eat ( specifierHandle)
939
- return . simpleTypeSpecifier ( RawSimpleTypeSpecifierSyntax ( specifier: specifier, arena: arena) )
881
+ return RawSimpleTypeSpecifierSyntax ( specifier: specifier, arena: arena)
940
882
}
941
883
942
884
mutating func parseTypeAttributeList(
@@ -945,26 +887,18 @@ extension Parser {
945
887
specifiers: RawTypeSpecifierListSyntax ,
946
888
attributes: RawAttributeListSyntax
947
889
) ? {
948
- var specifiers : [ RawTypeSpecifierListSyntax . Element ] = [ ]
890
+ var specifiers : [ RawSimpleTypeSpecifierSyntax ] = [ ]
949
891
SPECIFIER_PARSING: while canHaveParameterSpecifier {
950
892
if let ( _, specifierHandle) = self . at ( anyIn: SimpleTypeSpecifierSyntax . SpecifierOptions. self) {
951
893
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
- }
958
894
} else {
959
895
break SPECIFIER_PARSING
960
896
}
961
897
}
962
898
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
968
902
)
969
903
}
970
904
0 commit comments