Skip to content

Commit 67b8123

Browse files
committed
Improve EffectSpecifiersSyntax.throwsSpecifier compatibility property
1 parent 0be9c62 commit 67b8123

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,20 @@ public extension DeclGroupSyntax {
5353
public extension EffectSpecifiersSyntax {
5454
@available(*, deprecated, message: "use throwsClause.throwsSpecifier")
5555
var throwsSpecifier: TokenSyntax? {
56-
throwsClause?.throwsSpecifier
56+
get { throwsClause?.throwsSpecifier }
57+
58+
set {
59+
guard let newSpecifier = newValue else {
60+
throwsClause = nil
61+
return
62+
}
63+
64+
if let throwsClause {
65+
self.throwsClause = throwsClause.with(\.throwsSpecifier, newSpecifier)
66+
} else {
67+
self.throwsClause = ThrowsClauseSyntax(throwsSpecifier: newSpecifier)
68+
}
69+
}
5770
}
5871
}
5972

0 commit comments

Comments
 (0)