Skip to content

Commit 2e28829

Browse files
author
Daiki Matsudate
committed
Use throwsClause
1 parent a8f5553 commit 2e28829

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

Sources/SwiftFormat/PrettyPrint/TokenStreamCreator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,9 +511,9 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
511511
/// Arranges the `async` and `throws` effect specifiers of a function or accessor declaration.
512512
private func arrangeEffectSpecifiers<Node: EffectSpecifiersSyntax>(_ node: Node) {
513513
before(node.asyncSpecifier, tokens: .break)
514-
before(node.throwsSpecifier, tokens: .break)
514+
before(node.throwsClause?.throwsSpecifier, tokens: .break)
515515
// Keep them together if both `async` and `throws` are present.
516-
if let asyncSpecifier = node.asyncSpecifier, let throwsSpecifier = node.throwsSpecifier {
516+
if let asyncSpecifier = node.asyncSpecifier, let throwsSpecifier = node.throwsClause?.throwsSpecifier {
517517
before(asyncSpecifier, tokens: .open)
518518
after(throwsSpecifier, tokens: .close)
519519
}

Sources/SwiftFormat/Rules/UseSynthesizedInitializer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public final class UseSynthesizedInitializer: SyntaxLintRule {
3636
// Collect any possible redundant initializers into a list
3737
} else if let initDecl = member.as(InitializerDeclSyntax.self) {
3838
guard initDecl.optionalMark == nil else { continue }
39-
guard initDecl.signature.effectSpecifiers?.throwsSpecifier == nil else { continue }
39+
guard initDecl.signature.effectSpecifiers?.throwsClause?.throwsSpecifier == nil else { continue }
4040
initializers.append(initDecl)
4141
}
4242
}

Sources/SwiftFormat/Rules/ValidateDocumentationComments.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public final class ValidateDocumentationComments: SyntaxLintRule {
6262
}
6363

6464
validateThrows(
65-
signature.effectSpecifiers?.throwsSpecifier,
65+
signature.effectSpecifiers?.throwsClause?.throwsSpecifier,
6666
name: name,
6767
throwsDescription: docComment.throws,
6868
node: node)

0 commit comments

Comments
 (0)