Skip to content

Commit bf5e9e8

Browse files
committed
Resolve issue where standalone return statemente incorrectly expected an expression
1 parent ce30583 commit bf5e9e8

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

Sources/SwiftParser/Declarations.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
extension TokenConsumer {
1616
func atStartOfDeclaration(
1717
isAtTopLevel: Bool = false,
18-
allowRecovery: Bool = false
18+
allowRecovery: Bool = false,
19+
allowCase: Bool = false
1920
) -> Bool {
2021
if self.at(anyIn: PoundDeclarationStart.self) != nil {
2122
return true

Sources/SwiftParser/Statements.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ extension Parser {
865865
let expr: RawExprSyntax?
866866
if
867867
!self.at(any: [
868-
RawTokenKind.rightBrace, .semicolon, .eof,
868+
.rightBrace, .caseKeyword, .semicolon, .eof,
869869
.poundIfKeyword, .poundErrorKeyword, .poundWarningKeyword,
870870
.poundEndifKeyword, .poundElseKeyword, .poundElseifKeyword
871871
])

Tests/SwiftParserTest/Statements.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ final class StatementTests: XCTestCase {
251251
]
252252
)
253253
}
254-
254+
255255
func testIfHasSymbol() {
256256
AssertParse(
257257
"""

0 commit comments

Comments
 (0)