Skip to content

Commit f6b0ca1

Browse files
authored
Merge pull request #1615 from kimdv/kimdv/-dont-generate-docs-for-buildables
Dont add docs to buildable extensions
2 parents 9876a95 + b29c1f9 commit f6b0ca1

File tree

2 files changed

+7
-72
lines changed

2 files changed

+7
-72
lines changed

CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntaxbuilder/BuildableNodesFile.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ let buildableNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
2222
let type = node.type
2323

2424
if let convenienceInit = try! createConvenienceInitializer(node: node) {
25-
let docComment = node.description?.split(separator: "\n", omittingEmptySubsequences: false).map { "/// \($0)" }.joined(separator: "\n") ?? ""
26-
ExtensionDeclSyntax(
27-
leadingTrivia: "\(docComment)\n",
28-
extendedType: SimpleTypeIdentifierSyntax(name: .identifier(type.syntaxBaseName))
29-
) {
30-
convenienceInit
31-
}
25+
DeclSyntax(
26+
"""
27+
extension \(raw: type.syntaxBaseName) {
28+
\(convenienceInit)
29+
}
30+
"""
31+
)
3232
}
3333
}
3434
}

Sources/SwiftSyntaxBuilder/generated/BuildableNodes.swift

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ extension DoStmtSyntax {
371371
}
372372
}
373373

374-
/// A `case` declaration of a Swift `enum`. It can have 1 or more `EnumCaseElement`s inside, each declaring a different case of the enum.
375374
extension EnumCaseDeclSyntax {
376375
/// A convenience initializer that allows initializing syntax collections using result builders
377376
public init(
@@ -403,7 +402,6 @@ extension EnumCaseDeclSyntax {
403402
}
404403
}
405404

406-
/// A Swift `enum` declaration.
407405
extension EnumDeclSyntax {
408406
/// A convenience initializer that allows initializing syntax collections using result builders
409407
public init(
@@ -819,14 +817,6 @@ extension IfExprSyntax {
819817
}
820818
}
821819

822-
/// An initializer declaration like the following.
823-
///
824-
/// ```swift
825-
/// init(someParameter: Int) {
826-
/// }
827-
/// ```
828-
///
829-
/// The body is optional because this node also represents initializer requirements inside protocols.
830820
extension InitializerDeclSyntax {
831821
/// A convenience initializer that allows initializing syntax collections using result builders
832822
public init(
@@ -1171,61 +1161,6 @@ extension SourceFileSyntax {
11711161
}
11721162
}
11731163

1174-
/// A struct declaration like the following.
1175-
///
1176-
/// ```swift
1177-
/// struct SomeStruct {
1178-
/// let someMember: String
1179-
/// var anotherMember: Int
1180-
///
1181-
/// func foo() {
1182-
/// print(someMember)
1183-
/// }
1184-
///
1185-
/// mutating func bar() {
1186-
/// anotherMember = 42
1187-
/// }
1188-
/// }
1189-
/// ```
1190-
///
1191-
/// A struct declaration may be declared without any members.
1192-
///
1193-
/// ```swift
1194-
/// struct EmptyStruct {
1195-
///
1196-
/// }
1197-
/// ```
1198-
///
1199-
/// A struct declaration may include a type inheritance clause listing
1200-
/// one or more protocols the struct conforms to.
1201-
///
1202-
/// The example below uses Hashable and Equatable protocols whose members
1203-
/// are automatically synthesized by the compiler if the struct contains
1204-
/// stored members that are themselves `Hashable` and `Equatable`.
1205-
///
1206-
/// ```swift
1207-
/// struct AdvancedStruct: Hashable, Equatable {
1208-
/// let someMember: String
1209-
/// var anotherMember: Int
1210-
/// }
1211-
/// ```
1212-
///
1213-
/// A struct declaration may include a generic parameter clause as well
1214-
/// as a generic where clause.
1215-
///
1216-
/// ```swift
1217-
/// struct Stack<Element> {
1218-
/// var items: [Element] = []
1219-
///
1220-
/// mutating func push(_ item: Element) {
1221-
/// items.append(item)
1222-
/// }
1223-
///
1224-
/// mutating func pop() -> Element {
1225-
/// return items.removeLast()
1226-
/// }
1227-
/// }
1228-
/// ```
12291164
extension StructDeclSyntax {
12301165
/// A convenience initializer that allows initializing syntax collections using result builders
12311166
public init(

0 commit comments

Comments
 (0)