@@ -209,6 +209,31 @@ public let DECL_NODES: [Node] = [
209
209
Node (
210
210
name: " AssociatedtypeDecl " ,
211
211
nameForDiagnostics: " associatedtype declaration " ,
212
+ description: """
213
+ An associated type declaration like the following.
214
+
215
+ ```swift
216
+ associatedtype Item
217
+ ```
218
+
219
+ An associated type declaration may contain a type initializer clause which represents a default type assignment for the associated type.
220
+
221
+ ```swift
222
+ associatedtype Item = Int
223
+ ```
224
+
225
+ An associated type declaration may be declared with an inheritance clause which specifies the required conformances.
226
+
227
+ ```swift
228
+ associatedtype Iterator: IteratorProtocol
229
+ ```
230
+
231
+ A generic where clause may be present, here is an example which shows an associated type containing an inheritance clauses and a generic where clause.
232
+
233
+ ```swift
234
+ associatedtype Iterator: IteratorProtocol where Iterator.Element == Item
235
+ ```
236
+ """ ,
212
237
kind: " Decl " ,
213
238
traits: [
214
239
" IdentifiedDecl " ,
@@ -219,37 +244,44 @@ public let DECL_NODES: [Node] = [
219
244
name: " Attributes " ,
220
245
kind: . collection( kind: " AttributeList " , collectionElementName: " Attribute " ) ,
221
246
nameForDiagnostics: " attributes " ,
247
+ description: " Attributes attached to the associated type declaration. " ,
222
248
isOptional: true
223
249
) ,
224
250
Child (
225
251
name: " Modifiers " ,
226
252
kind: . collection( kind: " ModifierList " , collectionElementName: " Modifier " ) ,
227
253
nameForDiagnostics: " modifiers " ,
254
+ description: " Modifiers attached to the associated type declaration. " ,
228
255
isOptional: true
229
256
) ,
230
257
Child (
231
258
name: " AssociatedtypeKeyword " ,
232
- kind: . token( choices: [ . keyword( text: " associatedtype " ) ] )
259
+ kind: . token( choices: [ . keyword( text: " associatedtype " ) ] ) ,
260
+ description: " The `associatedtype` keyword for this declaration. "
233
261
) ,
234
262
Child (
235
263
name: " Identifier " ,
236
- kind: . token( choices: [ . token( tokenKind: " IdentifierToken " ) ] )
264
+ kind: . token( choices: [ . token( tokenKind: " IdentifierToken " ) ] ) ,
265
+ description: " The name of this associated type. "
237
266
) ,
238
267
Child (
239
268
name: " InheritanceClause " ,
240
269
kind: . node( kind: " TypeInheritanceClause " ) ,
241
270
nameForDiagnostics: " inheritance clause " ,
271
+ description: " The inheritance clause describing conformances for this associated type declaration. " ,
242
272
isOptional: true
243
273
) ,
244
274
Child (
245
275
name: " Initializer " ,
246
276
kind: . node( kind: " TypeInitializerClause " ) ,
277
+ description: " The type initializer clause for this associated type declaration which represents a default type assignment for the associated type. " ,
247
278
isOptional: true
248
279
) ,
249
280
Child (
250
281
name: " GenericWhereClause " ,
251
282
kind: . node( kind: " GenericWhereClause " ) ,
252
283
nameForDiagnostics: " generic where clause " ,
284
+ description: " The `where` clause that applies to the generic parameters of this associated type declaration. " ,
253
285
isOptional: true
254
286
) ,
255
287
]
@@ -265,6 +297,29 @@ public let DECL_NODES: [Node] = [
265
297
Node (
266
298
name: " ClassDecl " ,
267
299
nameForDiagnostics: " class " ,
300
+ description: """
301
+ A class declaration like the following.
302
+
303
+ ```swift
304
+ class SomeClass {
305
+ let someMember: String
306
+
307
+ init(someMember: String) {
308
+ self.someMember = someMember
309
+ }
310
+
311
+ func foo() {
312
+ print(someMember)
313
+ }
314
+
315
+ static func bar() -> Int {
316
+ return 1
317
+ }
318
+ }
319
+ ```
320
+
321
+ A class declaration may be declared without any members.
322
+ """ ,
268
323
kind: " Decl " ,
269
324
traits: [
270
325
" DeclGroup " ,
@@ -276,43 +331,51 @@ public let DECL_NODES: [Node] = [
276
331
name: " Attributes " ,
277
332
kind: . collection( kind: " AttributeList " , collectionElementName: " Attribute " ) ,
278
333
nameForDiagnostics: " attributes " ,
334
+ description: " Attributes attached to the class declaration. " ,
279
335
isOptional: true
280
336
) ,
281
337
Child (
282
338
name: " Modifiers " ,
283
339
kind: . collection( kind: " ModifierList " , collectionElementName: " Modifier " ) ,
284
340
nameForDiagnostics: " modifiers " ,
341
+ description: " Modifiers attached to the class declaration. " ,
285
342
isOptional: true
286
343
) ,
287
344
Child (
288
345
name: " ClassKeyword " ,
289
- kind: . token( choices: [ . keyword( text: " class " ) ] )
346
+ kind: . token( choices: [ . keyword( text: " class " ) ] ) ,
347
+ description: " The `class` keyword for this declaration. "
290
348
) ,
291
349
Child (
292
350
name: " Identifier " ,
293
- kind: . token( choices: [ . token( tokenKind: " IdentifierToken " ) ] )
351
+ kind: . token( choices: [ . token( tokenKind: " IdentifierToken " ) ] ) ,
352
+ description: " The name of the class. "
294
353
) ,
295
354
Child (
296
355
name: " GenericParameterClause " ,
297
356
kind: . node( kind: " GenericParameterClause " ) ,
298
357
nameForDiagnostics: " generic parameter clause " ,
358
+ description: " The generic parameters, if any, of the class declaration. " ,
299
359
isOptional: true
300
360
) ,
301
361
Child (
302
362
name: " InheritanceClause " ,
303
363
kind: . node( kind: " TypeInheritanceClause " ) ,
304
364
nameForDiagnostics: " inheritance clause " ,
365
+ description: " The inheritance clause describing one or more conformances for this class declaration. " ,
305
366
isOptional: true
306
367
) ,
307
368
Child (
308
369
name: " GenericWhereClause " ,
309
370
kind: . node( kind: " GenericWhereClause " ) ,
310
371
nameForDiagnostics: " generic where clause " ,
372
+ description: " The `where` clause that applies to the generic parameters of this class declaration. " ,
311
373
isOptional: true
312
374
) ,
313
375
Child (
314
376
name: " MemberBlock " ,
315
- kind: . node( kind: " MemberDeclBlock " )
377
+ kind: . node( kind: " MemberDeclBlock " ) ,
378
+ description: " The members of the class declaration. As class extension declarations may declare additional members, the contents of this member block isn't guaranteed to be a complete list of members for this type. "
316
379
) ,
317
380
]
318
381
) ,
@@ -992,6 +1055,13 @@ public let DECL_NODES: [Node] = [
992
1055
Node (
993
1056
name: " ImportDecl " ,
994
1057
nameForDiagnostics: " import " ,
1058
+ description: """
1059
+ An import declaration like the following.
1060
+
1061
+ ```swift
1062
+ import Foundation
1063
+ ```
1064
+ """ ,
995
1065
kind: " Decl " ,
996
1066
traits: [
997
1067
" Attributed "
@@ -1001,26 +1071,31 @@ public let DECL_NODES: [Node] = [
1001
1071
name: " Attributes " ,
1002
1072
kind: . collection( kind: " AttributeList " , collectionElementName: " Attribute " ) ,
1003
1073
nameForDiagnostics: " attributes " ,
1074
+ description: " Attributes attached to the import declaration. " ,
1004
1075
isOptional: true
1005
1076
) ,
1006
1077
Child (
1007
1078
name: " Modifiers " ,
1008
1079
kind: . collection( kind: " ModifierList " , collectionElementName: " Modifier " ) ,
1009
1080
nameForDiagnostics: " modifiers " ,
1081
+ description: " Modifiers attached to the import declaration " ,
1010
1082
isOptional: true
1011
1083
) ,
1012
1084
Child (
1013
1085
name: " ImportTok " ,
1014
- kind: . token( choices: [ . keyword( text: " import " ) ] )
1086
+ kind: . token( choices: [ . keyword( text: " import " ) ] ) ,
1087
+ description: " The `import` keyword for this declaration. "
1015
1088
) ,
1016
1089
Child (
1017
1090
name: " ImportKind " ,
1018
1091
kind: . token( choices: [ . keyword( text: " typealias " ) , . keyword( text: " struct " ) , . keyword( text: " class " ) , . keyword( text: " enum " ) , . keyword( text: " protocol " ) , . keyword( text: " var " ) , . keyword( text: " let " ) , . keyword( text: " func " ) , . keyword( text: " inout " ) ] ) ,
1092
+ description: " The kind of declaration being imported. " ,
1019
1093
isOptional: true
1020
1094
) ,
1021
1095
Child (
1022
1096
name: " Path " ,
1023
- kind: . collection( kind: " AccessPath " , collectionElementName: " PathComponent " )
1097
+ kind: . collection( kind: " AccessPath " , collectionElementName: " PathComponent " ) ,
1098
+ description: " The access path to the module, submodule or symbol being imported. "
1024
1099
) ,
1025
1100
]
1026
1101
) ,
@@ -1715,6 +1790,15 @@ public let DECL_NODES: [Node] = [
1715
1790
Node (
1716
1791
name: " ProtocolDecl " ,
1717
1792
nameForDiagnostics: " protocol " ,
1793
+ description: """
1794
+ A protocol declaration like the following.
1795
+
1796
+ ```swift
1797
+ protocol Example {
1798
+ var isValid: Bool { get }
1799
+ }
1800
+ ```
1801
+ """ ,
1718
1802
kind: " Decl " ,
1719
1803
traits: [
1720
1804
" DeclGroup " ,
@@ -1726,43 +1810,51 @@ public let DECL_NODES: [Node] = [
1726
1810
name: " Attributes " ,
1727
1811
kind: . collection( kind: " AttributeList " , collectionElementName: " Attribute " ) ,
1728
1812
nameForDiagnostics: " attributes " ,
1813
+ description: " Attributes attached to the protocol declaration. " ,
1729
1814
isOptional: true
1730
1815
) ,
1731
1816
Child (
1732
1817
name: " Modifiers " ,
1733
1818
kind: . collection( kind: " ModifierList " , collectionElementName: " Modifier " ) ,
1734
1819
nameForDiagnostics: " modifiers " ,
1820
+ description: " Modifiers attached to the protocol declaration. " ,
1735
1821
isOptional: true
1736
1822
) ,
1737
1823
Child (
1738
1824
name: " ProtocolKeyword " ,
1739
- kind: . token( choices: [ . keyword( text: " protocol " ) ] )
1825
+ kind: . token( choices: [ . keyword( text: " protocol " ) ] ) ,
1826
+ description: " The `protocol` keyword for this declaration. "
1740
1827
) ,
1741
1828
Child (
1742
1829
name: " Identifier " ,
1743
- kind: . token( choices: [ . token( tokenKind: " IdentifierToken " ) ] )
1830
+ kind: . token( choices: [ . token( tokenKind: " IdentifierToken " ) ] ) ,
1831
+ description: " The name of the protocol. "
1744
1832
) ,
1745
1833
Child (
1746
1834
name: " PrimaryAssociatedTypeClause " ,
1747
1835
kind: . node( kind: " PrimaryAssociatedTypeClause " ) ,
1748
1836
nameForDiagnostics: " primary associated type clause " ,
1837
+ description: " The primary associated type for the protocol. " ,
1749
1838
isOptional: true
1750
1839
) ,
1751
1840
Child (
1752
1841
name: " InheritanceClause " ,
1753
1842
kind: . node( kind: " TypeInheritanceClause " ) ,
1754
1843
nameForDiagnostics: " inheritance clause " ,
1844
+ description: " The inheritance clause describing one or more conformances for this protocol declaration. " ,
1755
1845
isOptional: true
1756
1846
) ,
1757
1847
Child (
1758
1848
name: " GenericWhereClause " ,
1759
1849
kind: . node( kind: " GenericWhereClause " ) ,
1760
1850
nameForDiagnostics: " generic where clause " ,
1851
+ description: " The `where` clause that applies to the generic parameters of this protocol declaration. " ,
1761
1852
isOptional: true
1762
1853
) ,
1763
1854
Child (
1764
1855
name: " MemberBlock " ,
1765
- kind: . node( kind: " MemberDeclBlock " )
1856
+ kind: . node( kind: " MemberDeclBlock " ) ,
1857
+ description: " The members of the protocol declaration. "
1766
1858
) ,
1767
1859
]
1768
1860
) ,
0 commit comments