@@ -57,6 +57,9 @@ public class Node {
57
57
/// function that should be invoked to create this node.
58
58
public let parserFunction : TokenSyntax ?
59
59
60
+ /// If `true`, if the node is deprecated and should not be used anymore.
61
+ public let isDeprecated : Bool
62
+
60
63
/// If `true`, this is for an experimental language feature, and any public
61
64
/// API generated should be SPI.
62
65
public var isExperimental : Bool { experimentalFeature != nil }
@@ -106,10 +109,16 @@ public class Node {
106
109
"""
107
110
experimentalSPI. with ( \. trailingTrivia, . newline)
108
111
}
112
+
109
113
if forRaw {
110
114
" @_spi(RawSyntax) "
111
115
}
116
+
117
+ if isDeprecated {
118
+ #"@available(*, deprecated, message: "This node is longer being generated by the parser.")"#
119
+ }
112
120
}
121
+
113
122
return attrList. with ( \. trailingTrivia, attrList. isEmpty ? [ ] : . newline)
114
123
}
115
124
@@ -128,6 +137,7 @@ public class Node {
128
137
kind: SyntaxNodeKind ,
129
138
base: SyntaxNodeKind ,
130
139
experimentalFeature: ExperimentalFeature ? = nil ,
140
+ isDeprecated: Bool = false ,
131
141
nameForDiagnostics: String ? ,
132
142
documentation: String ? = nil ,
133
143
parserFunction: TokenSyntax ? = nil ,
@@ -140,6 +150,7 @@ public class Node {
140
150
self . kind = kind
141
151
self . base = base
142
152
self . experimentalFeature = experimentalFeature
153
+ self . isDeprecated = isDeprecated
143
154
self . nameForDiagnostics = nameForDiagnostics
144
155
self . documentation = SwiftSyntax . Trivia. docCommentTrivia ( from: documentation)
145
156
self . parserFunction = parserFunction
@@ -272,6 +283,7 @@ public class Node {
272
283
kind: SyntaxNodeKind ,
273
284
base: SyntaxNodeKind ,
274
285
experimentalFeature: ExperimentalFeature ? = nil ,
286
+ isDeprecated: Bool = false ,
275
287
nameForDiagnostics: String ? ,
276
288
documentation: String ? = nil ,
277
289
parserFunction: TokenSyntax ? = nil ,
@@ -281,6 +293,7 @@ public class Node {
281
293
precondition ( base == . syntaxCollection)
282
294
self . base = base
283
295
self . experimentalFeature = experimentalFeature
296
+ self . isDeprecated = isDeprecated
284
297
self . nameForDiagnostics = nameForDiagnostics
285
298
self . documentation = SwiftSyntax . Trivia. docCommentTrivia ( from: documentation)
286
299
self . parserFunction = parserFunction
0 commit comments