@@ -407,22 +407,6 @@ extension Parser {
407
407
}
408
408
409
409
extension Parser {
410
- /// Attempt to consume an ellipsis prefix, splitting the current token if
411
- /// necessary.
412
- mutating func tryConsumeEllipsisPrefix( ) -> RawTokenSyntax ? {
413
- // It is not sufficient to check currentToken.isEllipsis here, as we may
414
- // have something like '...>'.
415
- // TODO: Recovery for different numbers of dots (which also needs to be
416
- // done for regular variadics).
417
- guard self . at ( anyIn: Operator . self) != nil else { return nil }
418
- let text = self . currentToken. tokenText
419
- guard text. hasPrefix ( " ... " ) else { return nil }
420
- return self . consumePrefix (
421
- SyntaxText ( rebasing: text. prefix ( 3 ) ) ,
422
- as: . ellipsis
423
- )
424
- }
425
-
426
410
mutating func parseGenericParameters( ) -> RawGenericParameterClauseSyntax {
427
411
if let remainingTokens = remainingTokensIfMaximumNestingLevelReached ( ) {
428
412
return RawGenericParameterClauseSyntax (
@@ -453,7 +437,7 @@ extension Parser {
453
437
454
438
// Parse the unsupported ellipsis for a type parameter pack 'T...'.
455
439
let unexpectedBetweenNameAndColon : RawUnexpectedNodesSyntax ?
456
- if let ellipsis = tryConsumeEllipsisPrefix ( ) {
440
+ if let ellipsis = self . consume ( ifPrefix : " ... " , as : . ellipsis ) {
457
441
unexpectedBetweenNameAndColon = RawUnexpectedNodesSyntax ( [ ellipsis] , arena: self . arena)
458
442
if each == nil {
459
443
each = missingToken ( . each)
@@ -923,7 +907,7 @@ extension Parser {
923
907
}
924
908
925
909
// Detect an attempt to use (early syntax) type parameter pack.
926
- let ellipsis = tryConsumeEllipsisPrefix ( )
910
+ let ellipsis = self . consume ( ifPrefix : " ... " , as : . ellipsis )
927
911
928
912
// Parse optional inheritance clause.
929
913
let inheritance : RawTypeInheritanceClauseSyntax ?
0 commit comments