@@ -734,7 +734,7 @@ extension Parser {
734
734
// If we can parse trailing closures, do so.
735
735
let trailingClosure : RawClosureExprSyntax ?
736
736
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) } ) {
738
738
( trailingClosure, additionalTrailingClosures) = self . parseTrailingClosures ( flavor)
739
739
} else {
740
740
trailingClosure = nil
@@ -770,7 +770,7 @@ extension Parser {
770
770
// If we can parse trailing closures, do so.
771
771
let trailingClosure : RawClosureExprSyntax ?
772
772
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) } ) {
774
774
( trailingClosure, additionalTrailingClosures) = self . parseTrailingClosures ( flavor)
775
775
} else {
776
776
trailingClosure = nil
@@ -793,7 +793,7 @@ extension Parser {
793
793
}
794
794
795
795
// 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) } ) {
797
797
// FIXME: if Result has a trailing closure, break out.
798
798
// Add dummy blank argument list to the call expression syntax.
799
799
let list = RawLabeledExprListSyntax ( elements: [ ] , arena: self . arena)
@@ -1321,7 +1321,7 @@ extension Parser {
1321
1321
// Parse the optional trailing closures.
1322
1322
let trailingClosure : RawClosureExprSyntax ?
1323
1323
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) } ) {
1325
1325
( trailingClosure, additionalTrailingClosures) = self . parseTrailingClosures ( flavor)
1326
1326
} else {
1327
1327
trailingClosure = nil
@@ -1915,7 +1915,7 @@ extension Parser {
1915
1915
// Parse labeled trailing closures.
1916
1916
var elements = [ RawMultipleTrailingClosureElementSyntax] ( )
1917
1917
var loopProgress = LoopProgressCondition ( )
1918
- while self . withLookahead ( { $0. isStartOfLabelledTrailingClosure ( ) } ) && self . hasProgressed ( & loopProgress) {
1918
+ while self . withLookahead ( { $0. atStartOfLabelledTrailingClosure ( ) } ) && self . hasProgressed ( & loopProgress) {
1919
1919
let ( unexpectedBeforeLabel, label) = self . parseArgumentLabel ( )
1920
1920
let ( unexpectedBeforeColon, colon) = self . expect ( . colon)
1921
1921
let closure = self . parseClosureExpression ( )
@@ -1937,7 +1937,7 @@ extension Parser {
1937
1937
}
1938
1938
1939
1939
extension Parser . Lookahead {
1940
- mutating func isStartOfLabelledTrailingClosure ( ) -> Bool {
1940
+ mutating func atStartOfLabelledTrailingClosure ( ) -> Bool {
1941
1941
// Fast path: the next two tokens must be a label and a colon.
1942
1942
// But 'default:' is ambiguous with switch cases and we disallow it
1943
1943
// (unless escaped) even outside of switches.
@@ -1967,12 +1967,12 @@ extension Parser.Lookahead {
1967
1967
/// where the parser requires an expr-basic (which does not allow them). We
1968
1968
/// handle this by doing some lookahead in common situations. And later, Sema
1969
1969
/// 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 {
1971
1971
precondition ( self . at ( . leftBrace) , " Couldn't be a trailing closure " )
1972
1972
1973
1973
// If this is the start of a get/set accessor, then it isn't a trailing
1974
1974
// closure.
1975
- guard !self . withLookahead ( { $0. isStartOfGetSetAccessor ( ) } ) else {
1975
+ guard !self . withLookahead ( { $0. atStartOfGetSetAccessor ( ) } ) else {
1976
1976
return false
1977
1977
}
1978
1978
0 commit comments