File tree Expand file tree Collapse file tree 3 files changed +13
-17
lines changed Expand file tree Collapse file tree 3 files changed +13
-17
lines changed Original file line number Diff line number Diff line change @@ -1122,7 +1122,7 @@ extension Parser {
1122
1122
let ( unexpectedBeforeDeinitKeyword, deinitKeyword) = self . eat ( handle)
1123
1123
var unexpectedNameAndSignature : [ RawSyntax ? ] = [ ]
1124
1124
unexpectedNameAndSignature. append ( self . consume ( if: TokenSpec ( . identifier, allowAtStartOfLine: false ) ) . map ( RawSyntax . init) )
1125
- if self . at ( . leftParen) && ! self . currentToken . isAtStartOfLine {
1125
+ if self . at ( TokenSpec ( . leftParen, allowAtStartOfLine : false ) ) {
1126
1126
unexpectedNameAndSignature. append ( RawSyntax ( parseFunctionSignature ( ) ) )
1127
1127
}
1128
1128
let items = self . parseOptionalCodeBlock ( )
@@ -1374,7 +1374,7 @@ extension Parser {
1374
1374
value: value,
1375
1375
arena: self . arena
1376
1376
)
1377
- } else if self . at ( . leftParen) , ! self . currentToken . isAtStartOfLine ,
1377
+ } else if self . at ( TokenSpec ( . leftParen, allowAtStartOfLine : false ) ) ,
1378
1378
let typeAnnotationUnwrapped = typeAnnotation
1379
1379
{
1380
1380
// If we have a '(' after the type in the annotation, the type annotation
Original file line number Diff line number Diff line change @@ -603,7 +603,7 @@ extension Parser {
603
603
604
604
let beforePeriodWhitespace = previousNode? . raw. trailingTriviaByteLength ?? 0 > 0 || self . currentToken. leadingTriviaByteLength > 0
605
605
let afterPeriodWhitespace = self . currentToken. trailingTriviaByteLength > 0 || self . peek ( ) . leadingTriviaByteLength > 0
606
- let afterContainsAnyNewline = self . peek ( ) . flags . contains ( . isAtStartOfLine)
606
+ let afterContainsAnyNewline = self . peek ( ) . isAtStartOfLine
607
607
608
608
let period = self . consumeAnyToken ( )
609
609
Original file line number Diff line number Diff line change @@ -295,15 +295,13 @@ extension Parser {
295
295
continue
296
296
}
297
297
298
- if !self . currentToken. isAtStartOfLine {
299
- if self . at ( . postfixQuestionMark) {
300
- base = RawTypeSyntax ( self . parseOptionalType ( base) )
301
- continue
302
- }
303
- if self . at ( . exclamationMark) {
304
- base = RawTypeSyntax ( self . parseImplicitlyUnwrappedOptionalType ( base) )
305
- continue
306
- }
298
+ if self . at ( TokenSpec ( . postfixQuestionMark, allowAtStartOfLine: false ) ) {
299
+ base = RawTypeSyntax ( self . parseOptionalType ( base) )
300
+ continue
301
+ }
302
+ if self . at ( TokenSpec ( . exclamationMark, allowAtStartOfLine: false ) ) {
303
+ base = RawTypeSyntax ( self . parseImplicitlyUnwrappedOptionalType ( base) )
304
+ continue
307
305
}
308
306
309
307
break
@@ -780,11 +778,9 @@ extension Parser.Lookahead {
780
778
return false
781
779
}
782
780
783
- if !self . currentToken. isAtStartOfLine {
784
- if self . at ( . postfixQuestionMark) || self . at ( . exclamationMark) {
785
- self . consumeAnyToken ( )
786
- continue
787
- }
781
+ if self . at ( TokenSpec ( . postfixQuestionMark, allowAtStartOfLine: false ) ) || self . at ( TokenSpec ( . exclamationMark, allowAtStartOfLine: false ) ) {
782
+ self . consumeAnyToken ( )
783
+ continue
788
784
}
789
785
790
786
break
You can’t perform that action at this time.
0 commit comments