Skip to content

Commit 427d59d

Browse files
authored
Merge pull request #1622 from whiteio/whiteio/deinit-syntax-node-documentation
Add documentation for DeinitializerDeclSyntax and all its children
2 parents 3c095d1 + 707ea3f commit 427d59d

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,14 @@ public let DECL_NODES: [Node] = [
398398
Node(
399399
name: "DeinitializerDecl",
400400
nameForDiagnostics: "deinitializer",
401+
description: """
402+
A deinitializer declaration like the following.
403+
404+
```swift
405+
deinit {
406+
}
407+
```
408+
""",
401409
kind: "Decl",
402410
traits: [
403411
"Attributed"
@@ -407,21 +415,25 @@ public let DECL_NODES: [Node] = [
407415
name: "Attributes",
408416
kind: .collection(kind: "AttributeList", collectionElementName: "Attribute"),
409417
nameForDiagnostics: "attributes",
418+
description: "Attributes that are attached to the deinitializer.",
410419
isOptional: true
411420
),
412421
Child(
413422
name: "Modifiers",
414423
kind: .collection(kind: "ModifierList", collectionElementName: "Modifier"),
415424
nameForDiagnostics: "modifiers",
425+
description: "Modifiers that are attached to the deinitializer.",
416426
isOptional: true
417427
),
418428
Child(
419429
name: "DeinitKeyword",
420-
kind: .token(choices: [.keyword(text: "deinit")])
430+
kind: .token(choices: [.keyword(text: "deinit")]),
431+
description: "The deinit keyword."
421432
),
422433
Child(
423434
name: "Body",
424435
kind: .node(kind: "CodeBlock"),
436+
description: "The deinitializer's body.",
425437
isOptional: true
426438
),
427439
]

Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,12 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
11571157

11581158
// MARK: - DeinitializerDeclSyntax
11591159

1160-
1160+
/// A deinitializer declaration like the following.
1161+
///
1162+
/// ```swift
1163+
/// deinit {
1164+
/// }
1165+
/// ```
11611166
public struct DeinitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
11621167
public let _syntaxNode: Syntax
11631168

@@ -1236,6 +1241,7 @@ public struct DeinitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
12361241
}
12371242
}
12381243

1244+
/// Attributes that are attached to the deinitializer.
12391245
public var attributes: AttributeListSyntax? {
12401246
get {
12411247
return data.child(at: 1, parent: Syntax(self)).map(AttributeListSyntax.init)
@@ -1273,6 +1279,7 @@ public struct DeinitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
12731279
}
12741280
}
12751281

1282+
/// Modifiers that are attached to the deinitializer.
12761283
public var modifiers: ModifierListSyntax? {
12771284
get {
12781285
return data.child(at: 3, parent: Syntax(self)).map(ModifierListSyntax.init)
@@ -1310,6 +1317,7 @@ public struct DeinitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
13101317
}
13111318
}
13121319

1320+
/// The deinit keyword.
13131321
public var deinitKeyword: TokenSyntax {
13141322
get {
13151323
return TokenSyntax(data.child(at: 5, parent: Syntax(self))!)
@@ -1328,6 +1336,7 @@ public struct DeinitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
13281336
}
13291337
}
13301338

1339+
/// The deinitializer's body.
13311340
public var body: CodeBlockSyntax? {
13321341
get {
13331342
return data.child(at: 7, parent: Syntax(self)).map(CodeBlockSyntax.init)

0 commit comments

Comments
 (0)