@@ -734,7 +734,7 @@ extension Parser {
734734 // If we can parse trailing closures, do so.
735735 let trailingClosure : RawClosureExprSyntax ?
736736 let additionalTrailingClosures : RawMultipleTrailingClosureElementListSyntax ?
737- if case . trailingClosure = flavor, self . at ( . leftBrace) , self . withLookahead ( { $0. isValidTrailingClosure ( flavor) } ) {
737+ if case . trailingClosure = flavor, self . at ( . leftBrace) , self . withLookahead ( { $0. atValidTrailingClosure ( flavor) } ) {
738738 ( trailingClosure, additionalTrailingClosures) = self . parseTrailingClosures ( flavor)
739739 } else {
740740 trailingClosure = nil
@@ -770,7 +770,7 @@ extension Parser {
770770 // If we can parse trailing closures, do so.
771771 let trailingClosure : RawClosureExprSyntax ?
772772 let additionalTrailingClosures : RawMultipleTrailingClosureElementListSyntax ?
773- if case . trailingClosure = flavor, self . at ( . leftBrace) , self . withLookahead ( { $0. isValidTrailingClosure ( flavor) } ) {
773+ if case . trailingClosure = flavor, self . at ( . leftBrace) , self . withLookahead ( { $0. atValidTrailingClosure ( flavor) } ) {
774774 ( trailingClosure, additionalTrailingClosures) = self . parseTrailingClosures ( flavor)
775775 } else {
776776 trailingClosure = nil
@@ -793,7 +793,7 @@ extension Parser {
793793 }
794794
795795 // Check for a trailing closure, if allowed.
796- if self . at ( . leftBrace) && self . withLookahead ( { $0. isValidTrailingClosure ( flavor) } ) {
796+ if self . at ( . leftBrace) && self . withLookahead ( { $0. atValidTrailingClosure ( flavor) } ) {
797797 // FIXME: if Result has a trailing closure, break out.
798798 // Add dummy blank argument list to the call expression syntax.
799799 let list = RawLabeledExprListSyntax ( elements: [ ] , arena: self . arena)
@@ -1321,7 +1321,7 @@ extension Parser {
13211321 // Parse the optional trailing closures.
13221322 let trailingClosure : RawClosureExprSyntax ?
13231323 let additionalTrailingClosures : RawMultipleTrailingClosureElementListSyntax ?
1324- if case . trailingClosure = flavor, self . at ( . leftBrace) , self . withLookahead ( { $0. isValidTrailingClosure ( flavor) } ) {
1324+ if case . trailingClosure = flavor, self . at ( . leftBrace) , self . withLookahead ( { $0. atValidTrailingClosure ( flavor) } ) {
13251325 ( trailingClosure, additionalTrailingClosures) = self . parseTrailingClosures ( flavor)
13261326 } else {
13271327 trailingClosure = nil
@@ -1915,7 +1915,7 @@ extension Parser {
19151915 // Parse labeled trailing closures.
19161916 var elements = [ RawMultipleTrailingClosureElementSyntax] ( )
19171917 var loopProgress = LoopProgressCondition ( )
1918- while self . withLookahead ( { $0. isStartOfLabelledTrailingClosure ( ) } ) && self . hasProgressed ( & loopProgress) {
1918+ while self . withLookahead ( { $0. atStartOfLabelledTrailingClosure ( ) } ) && self . hasProgressed ( & loopProgress) {
19191919 let ( unexpectedBeforeLabel, label) = self . parseArgumentLabel ( )
19201920 let ( unexpectedBeforeColon, colon) = self . expect ( . colon)
19211921 let closure = self . parseClosureExpression ( )
@@ -1937,7 +1937,7 @@ extension Parser {
19371937}
19381938
19391939extension Parser . Lookahead {
1940- mutating func isStartOfLabelledTrailingClosure ( ) -> Bool {
1940+ mutating func atStartOfLabelledTrailingClosure ( ) -> Bool {
19411941 // Fast path: the next two tokens must be a label and a colon.
19421942 // But 'default:' is ambiguous with switch cases and we disallow it
19431943 // (unless escaped) even outside of switches.
@@ -1967,12 +1967,12 @@ extension Parser.Lookahead {
19671967 /// where the parser requires an expr-basic (which does not allow them). We
19681968 /// handle this by doing some lookahead in common situations. And later, Sema
19691969 /// will emit a diagnostic with a fixit to add wrapping parens.
1970- mutating func isValidTrailingClosure ( _ flavor: Parser . ExprFlavor ) -> Bool {
1970+ mutating func atValidTrailingClosure ( _ flavor: Parser . ExprFlavor ) -> Bool {
19711971 precondition ( self . at ( . leftBrace) , " Couldn't be a trailing closure " )
19721972
19731973 // If this is the start of a get/set accessor, then it isn't a trailing
19741974 // closure.
1975- guard !self . withLookahead ( { $0. isStartOfGetSetAccessor ( ) } ) else {
1975+ guard !self . withLookahead ( { $0. atStartOfGetSetAccessor ( ) } ) else {
19761976 return false
19771977 }
19781978
0 commit comments