Skip to content

Add documentation for DeinitializerDeclSyntax and all its children #1622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,14 @@ public let DECL_NODES: [Node] = [
Node(
name: "DeinitializerDecl",
nameForDiagnostics: "deinitializer",
description: """
A deinitializer declaration like the following.

```swift
deinit {
}
```
""",
kind: "Decl",
traits: [
"Attributed"
Expand All @@ -407,21 +415,25 @@ public let DECL_NODES: [Node] = [
name: "Attributes",
kind: .collection(kind: "AttributeList", collectionElementName: "Attribute"),
nameForDiagnostics: "attributes",
description: "Attributes that are attached to the deinitializer.",
isOptional: true
),
Child(
name: "Modifiers",
kind: .collection(kind: "ModifierList", collectionElementName: "Modifier"),
nameForDiagnostics: "modifiers",
description: "Modifiers that are attached to the deinitializer.",
isOptional: true
),
Child(
name: "DeinitKeyword",
kind: .token(choices: [.keyword(text: "deinit")])
kind: .token(choices: [.keyword(text: "deinit")]),
description: "The deinit keyword."
),
Child(
name: "Body",
kind: .node(kind: "CodeBlock"),
description: "The deinitializer's body.",
isOptional: true
),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,12 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {

// MARK: - DeinitializerDeclSyntax


/// A deinitializer declaration like the following.
///
/// ```swift
/// deinit {
/// }
/// ```
public struct DeinitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
public let _syntaxNode: Syntax

Expand Down Expand Up @@ -1236,6 +1241,7 @@ public struct DeinitializerDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
}
}

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

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

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

/// The deinitializer's body.
public var body: CodeBlockSyntax? {
get {
return data.child(at: 7, parent: Syntax(self)).map(CodeBlockSyntax.init)
Expand Down