File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Sources/SwiftSyntaxBuilder Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,18 @@ extension CodeBlockItemListBuilder {
40
40
public static func buildExpression( _ expression: some Sequence < DeclSyntaxProtocol > ) -> Component {
41
41
buildExpression ( expression. map { CodeBlockItemSyntax ( item: . decl( DeclSyntax ( $0) ) ) } )
42
42
}
43
+
44
+ public static func buildFinalResult( _ component: Component ) -> CodeBlockItemListSyntax {
45
+ . init(
46
+ component. enumerated ( ) . map { ( index, expression) in
47
+ if index > component. startIndex, !expression. leadingTrivia. contains ( where: \. isNewline) {
48
+ expression. with ( \. leadingTrivia, . newline. merging ( expression. leadingTrivia) )
49
+ } else {
50
+ expression
51
+ }
52
+ }
53
+ )
54
+ }
43
55
}
44
56
45
57
extension ConditionElementListBuilder {
You can’t perform that action at this time.
0 commit comments