File tree Expand file tree Collapse file tree 2 files changed +2
-21
lines changed
generate-swift-syntax/templates/swiftsyntax Expand file tree Collapse file tree 2 files changed +2
-21
lines changed Original file line number Diff line number Diff line change @@ -114,14 +114,7 @@ public class Child {
114
114
"""
115
115
)
116
116
117
- let separator = SwiftSyntax . Trivia ( pieces: [ TriviaPiece . newlines ( 1 ) , TriviaPiece . docLineComment ( " /// " ) , TriviaPiece . newlines ( 1 ) ] )
118
-
119
- // Grab the documentation secions, filter out empty ones, and join them
120
- // with an empty documentation line inbetween.
121
- return [ documentationSummary, tokenChoicesTrivia]
122
- . filter { !$0. isEmpty }
123
- . joined ( separator: separator)
124
- . reduce ( SwiftSyntax . Trivia ( ) , { $0. appending ( $1) } )
117
+ return SwiftSyntax . Trivia ( joining: [ documentationSummary, tokenChoicesTrivia] )
125
118
}
126
119
127
120
// If this child is not a token kind, return documentation summary without the choices list.
Original file line number Diff line number Diff line change @@ -22,24 +22,12 @@ import Utils
22
22
func syntaxNode( nodesStartingWith: [ Character ] ) -> SourceFileSyntax {
23
23
SourceFileSyntax ( leadingTrivia: copyrightHeader) {
24
24
for node in SYNTAX_NODES . compactMap ( \. layoutNode) where nodesStartingWith. contains ( node. kind. syntaxType. description. first!) {
25
- let documentationSections = [
26
- node. documentation,
27
- node. grammar,
28
- node. containedIn,
29
- ]
30
- let documentation =
31
- documentationSections
32
- . filter { !$0. isEmpty }
33
- . map { [ $0] }
34
- . joined ( separator: [ Trivia . newline, Trivia . docLineComment ( " /// " ) , Trivia . newline] )
35
- . reduce ( Trivia ( ) , + )
36
-
37
25
// We are actually handling this node now
38
26
try ! StructDeclSyntax (
39
27
"""
40
28
// MARK: - \( node. kind. syntaxType)
41
29
42
- \( documentation)
30
+ \( SwiftSyntax . Trivia ( joining : [ node . documentation, node . grammar , node . containedIn ] ) )
43
31
\( node. node. apiAttributes ( ) ) \
44
32
public struct \( node. kind. syntaxType) : \( node. baseType. syntaxBaseName) Protocol, SyntaxHashable, \( node. base. leafProtocolType)
45
33
"""
You can’t perform that action at this time.
0 commit comments