Skip to content

Commit 26b36e9

Browse files
committed
Backwards compatibility
1 parent e2e7a31 commit 26b36e9

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,36 @@
1313
// This file provides compatibility aliases to keep dependents of SwiftSyntax building.
1414
// All users of the declarations in this file should transition away from them ASAP.
1515

16+
extension AccessorDeclSyntax {
17+
@available(*, deprecated, message: "use modifiers to see all modifiers on an accessor declaration")
18+
public var modifier: DeclModifierSyntax? {
19+
get {
20+
// The legacy `modifier` API predates `yielding`
21+
if let m = modifiers.first(where: {$0.name.text != "yielding"}) {
22+
return m
23+
}
24+
return nil
25+
}
26+
set {
27+
if let newValue {
28+
modifiers = [newValue]
29+
} else {
30+
modifiers = []
31+
}
32+
}
33+
}
34+
@available(*, deprecated, message: "use unexpectedBetweenAttributesAndModifers")
35+
public var unexpectedBetweenAttributesAndModifier: UnexpectedNodesSyntax? {
36+
get { unexpectedBetweenAttributesAndModifiers }
37+
set { unexpectedBetweenAttributesAndModifiers = newValue }
38+
}
39+
@available(*, deprecated, message: "use unexpectedBetweenModifiersAndAccessorSpecifier")
40+
public var unexpectedBetweenModifierAndAccessorSpecifier: UnexpectedNodesSyntax? {
41+
get { unexpectedBetweenModifiersAndAccessorSpecifier }
42+
set { unexpectedBetweenModifiersAndAccessorSpecifier = newValue }
43+
}
44+
}
45+
1646
extension AccessorEffectSpecifiersSyntax {
1747
@_disfavoredOverload
1848
@available(*, deprecated, message: "use throwsClause instead of throwsSpecifier")

0 commit comments

Comments
 (0)