Skip to content

Commit ee9e96d

Browse files
committed
Add init documentation
1 parent e73e11b commit ee9e96d

File tree

2 files changed

+1167
-0
lines changed

2 files changed

+1167
-0
lines changed

Sources/SwiftSyntaxBuilder/Buildables.swift.gyb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,18 @@ public struct ${node.syntax_kind}: ${node.base_kind}Buildable {
121121
let ${"%s: %s" % (child.swift_name, param_type)}
122122
% end
123123

124+
/// Creates a `${node.syntax_kind}` using the provided parameters.
125+
/// - Parameters:
126+
% for child in node.children:
127+
% description = ""
128+
% if child.description:
129+
% for line in dedented_lines(child.description):
130+
% description += line
131+
% end
132+
% end
133+
% description = description.replace("\n", " ").strip()
134+
/// - ${lowercase_first_word(child.name)}: ${description}
135+
% end
124136
public init(
125137
% init_parameters = []
126138
% for child in node.children:
@@ -191,6 +203,9 @@ public struct ${node.syntax_kind}: ${node.base_kind}Buildable {
191203
public struct ${node.syntax_kind}: SyntaxBuildable {
192204
let elements: [${element_type}]
193205

206+
/// Creates a `${node.syntax_kind}` with the provided list of elements.
207+
/// - Parameters:
208+
/// - elements: A list of `ExpressibleAs${element_type}`
194209
public init(_ elements: [ExpressibleAs${element_type}]) {
195210
self.elements = elements.map { $0.create${element_type}() }
196211
}

0 commit comments

Comments
 (0)