@@ -57,6 +57,9 @@ public class Node {
5757 /// function that should be invoked to create this node.
5858 public let parserFunction : TokenSyntax ?
5959
60+ /// If `true`, if the node is deprecated and should not be used anymore.
61+ public let isDeprecated : Bool
62+
6063 /// If `true`, this is for an experimental language feature, and any public
6164 /// API generated should be SPI.
6265 public var isExperimental : Bool { experimentalFeature != nil }
@@ -106,10 +109,16 @@ public class Node {
106109 """
107110 experimentalSPI. with ( \. trailingTrivia, . newline)
108111 }
112+
109113 if forRaw {
110114 " @_spi(RawSyntax) "
111115 }
116+
117+ if isDeprecated {
118+ #"@available(*, deprecated, message: "This node is longer being generated by the parser.")"#
119+ }
112120 }
121+
113122 return attrList. with ( \. trailingTrivia, attrList. isEmpty ? [ ] : . newline)
114123 }
115124
@@ -128,6 +137,7 @@ public class Node {
128137 kind: SyntaxNodeKind ,
129138 base: SyntaxNodeKind ,
130139 experimentalFeature: ExperimentalFeature ? = nil ,
140+ isDeprecated: Bool = false ,
131141 nameForDiagnostics: String ? ,
132142 documentation: String ? = nil ,
133143 parserFunction: TokenSyntax ? = nil ,
@@ -140,6 +150,7 @@ public class Node {
140150 self . kind = kind
141151 self . base = base
142152 self . experimentalFeature = experimentalFeature
153+ self . isDeprecated = isDeprecated
143154 self . nameForDiagnostics = nameForDiagnostics
144155 self . documentation = SwiftSyntax . Trivia. docCommentTrivia ( from: documentation)
145156 self . parserFunction = parserFunction
@@ -272,6 +283,7 @@ public class Node {
272283 kind: SyntaxNodeKind ,
273284 base: SyntaxNodeKind ,
274285 experimentalFeature: ExperimentalFeature ? = nil ,
286+ isDeprecated: Bool = false ,
275287 nameForDiagnostics: String ? ,
276288 documentation: String ? = nil ,
277289 parserFunction: TokenSyntax ? = nil ,
@@ -281,6 +293,7 @@ public class Node {
281293 precondition ( base == . syntaxCollection)
282294 self . base = base
283295 self . experimentalFeature = experimentalFeature
296+ self . isDeprecated = isDeprecated
284297 self . nameForDiagnostics = nameForDiagnostics
285298 self . documentation = SwiftSyntax . Trivia. docCommentTrivia ( from: documentation)
286299 self . parserFunction = parserFunction
0 commit comments