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 {
114114 """
115115 )
116116
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] )
125118 }
126119
127120 // 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
2222func syntaxNode( nodesStartingWith: [ Character ] ) -> SourceFileSyntax {
2323 SourceFileSyntax ( leadingTrivia: copyrightHeader) {
2424 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-
3725 // We are actually handling this node now
3826 try ! StructDeclSyntax (
3927 """
4028 // MARK: - \( node. kind. syntaxType)
4129
42- \( documentation)
30+ \( SwiftSyntax . Trivia ( joining : [ node . documentation, node . grammar , node . containedIn ] ) )
4331 \( node. node. apiAttributes ( ) ) \
4432 public struct \( node. kind. syntaxType) : \( node. baseType. syntaxBaseName) Protocol, SyntaxHashable, \( node. base. leafProtocolType)
4533 """
You can’t perform that action at this time.
0 commit comments