16
16
import SwiftSyntax
17
17
public protocol DeclListBuildable : SyntaxListBuildable {
18
18
/// Builds list of `DeclSyntax`s.
19
- /// - Parameter format: The `Format` to use.
20
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
21
- func buildDeclList( format: Format , leadingTrivia: Trivia ? ) -> [ DeclSyntax ]
19
+ /// - Parameter format: The `Format` to use.
20
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
21
+ func buildDeclList( format: Format , leadingTrivia: Trivia ? ) -> [ DeclSyntax ]
22
22
}
23
23
public protocol DeclBuildable : ExpressibleAsDeclBuildable , DeclListBuildable , SyntaxBuildable {
24
24
/// Builds list of `DeclSyntax`s.
25
- /// - Parameter format: The `Format` to use.
26
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
27
- func buildDecl( format: Format , leadingTrivia: Trivia ? ) -> DeclSyntax
25
+ /// - Parameter format: The `Format` to use.
26
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
27
+ func buildDecl( format: Format , leadingTrivia: Trivia ? ) -> DeclSyntax
28
28
}
29
29
public extension DeclBuildable {
30
30
/// Satisfies conformance to `ExpressibleAsDeclBuildable`.
31
- func createDeclBuildable( ) -> DeclBuildable {
31
+ func createDeclBuildable( ) -> DeclBuildable {
32
32
return self
33
33
}
34
34
/// Builds list of `DeclSyntax`s.
35
- /// - Parameter format: The `Format` to use.
36
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
37
- ///
38
- /// Satisfies conformance to `DeclListBuildable`
39
- func buildDeclList( format: Format , leadingTrivia: Trivia ? = nil ) -> [ DeclSyntax ] {
35
+ /// - Parameter format: The `Format` to use.
36
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
37
+ ///
38
+ /// Satisfies conformance to `DeclListBuildable`
39
+ func buildDeclList( format: Format , leadingTrivia: Trivia ? = nil ) -> [ DeclSyntax ] {
40
40
return [ buildDecl ( format: format, leadingTrivia: leadingTrivia) ]
41
41
}
42
42
/// Builds a `DeclSyntax`.
43
- /// - Parameter format: The `Format` to use.
44
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
45
- /// - Returns: A new `Syntax` with the built `DeclSyntax`.
46
- ///
47
- /// Satisfies conformance to `SyntaxBuildable`.
48
- func buildSyntax( format: Format , leadingTrivia: Trivia ? = nil ) -> Syntax {
43
+ /// - Parameter format: The `Format` to use.
44
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
45
+ /// - Returns: A new `Syntax` with the built `DeclSyntax`.
46
+ ///
47
+ /// Satisfies conformance to `SyntaxBuildable`.
48
+ func buildSyntax( format: Format , leadingTrivia: Trivia ? = nil ) -> Syntax {
49
49
return Syntax ( buildDecl ( format: format, leadingTrivia: leadingTrivia) )
50
50
}
51
51
}
52
52
public protocol ExprListBuildable : SyntaxListBuildable {
53
53
/// Builds list of `ExprSyntax`s.
54
- /// - Parameter format: The `Format` to use.
55
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
56
- func buildExprList( format: Format , leadingTrivia: Trivia ? ) -> [ ExprSyntax ]
54
+ /// - Parameter format: The `Format` to use.
55
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
56
+ func buildExprList( format: Format , leadingTrivia: Trivia ? ) -> [ ExprSyntax ]
57
57
}
58
58
public protocol ExprBuildable : ExpressibleAsExprBuildable , ExprListBuildable , SyntaxBuildable {
59
59
/// Builds list of `ExprSyntax`s.
60
- /// - Parameter format: The `Format` to use.
61
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
62
- func buildExpr( format: Format , leadingTrivia: Trivia ? ) -> ExprSyntax
60
+ /// - Parameter format: The `Format` to use.
61
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
62
+ func buildExpr( format: Format , leadingTrivia: Trivia ? ) -> ExprSyntax
63
63
}
64
64
public extension ExprBuildable {
65
65
/// Satisfies conformance to `ExpressibleAsExprBuildable`.
66
- func createExprBuildable( ) -> ExprBuildable {
66
+ func createExprBuildable( ) -> ExprBuildable {
67
67
return self
68
68
}
69
69
/// Builds list of `ExprSyntax`s.
70
- /// - Parameter format: The `Format` to use.
71
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
72
- ///
73
- /// Satisfies conformance to `ExprListBuildable`
74
- func buildExprList( format: Format , leadingTrivia: Trivia ? = nil ) -> [ ExprSyntax ] {
70
+ /// - Parameter format: The `Format` to use.
71
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
72
+ ///
73
+ /// Satisfies conformance to `ExprListBuildable`
74
+ func buildExprList( format: Format , leadingTrivia: Trivia ? = nil ) -> [ ExprSyntax ] {
75
75
return [ buildExpr ( format: format, leadingTrivia: leadingTrivia) ]
76
76
}
77
77
/// Builds a `ExprSyntax`.
78
- /// - Parameter format: The `Format` to use.
79
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
80
- /// - Returns: A new `Syntax` with the built `ExprSyntax`.
81
- ///
82
- /// Satisfies conformance to `SyntaxBuildable`.
83
- func buildSyntax( format: Format , leadingTrivia: Trivia ? = nil ) -> Syntax {
78
+ /// - Parameter format: The `Format` to use.
79
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
80
+ /// - Returns: A new `Syntax` with the built `ExprSyntax`.
81
+ ///
82
+ /// Satisfies conformance to `SyntaxBuildable`.
83
+ func buildSyntax( format: Format , leadingTrivia: Trivia ? = nil ) -> Syntax {
84
84
return Syntax ( buildExpr ( format: format, leadingTrivia: leadingTrivia) )
85
85
}
86
86
}
87
87
public protocol PatternListBuildable : SyntaxListBuildable {
88
88
/// Builds list of `PatternSyntax`s.
89
- /// - Parameter format: The `Format` to use.
90
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
91
- func buildPatternList( format: Format , leadingTrivia: Trivia ? ) -> [ PatternSyntax ]
89
+ /// - Parameter format: The `Format` to use.
90
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
91
+ func buildPatternList( format: Format , leadingTrivia: Trivia ? ) -> [ PatternSyntax ]
92
92
}
93
93
public protocol PatternBuildable : ExpressibleAsPatternBuildable , PatternListBuildable , SyntaxBuildable {
94
94
/// Builds list of `PatternSyntax`s.
95
- /// - Parameter format: The `Format` to use.
96
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
97
- func buildPattern( format: Format , leadingTrivia: Trivia ? ) -> PatternSyntax
95
+ /// - Parameter format: The `Format` to use.
96
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
97
+ func buildPattern( format: Format , leadingTrivia: Trivia ? ) -> PatternSyntax
98
98
}
99
99
public extension PatternBuildable {
100
100
/// Satisfies conformance to `ExpressibleAsPatternBuildable`.
101
- func createPatternBuildable( ) -> PatternBuildable {
101
+ func createPatternBuildable( ) -> PatternBuildable {
102
102
return self
103
103
}
104
104
/// Builds list of `PatternSyntax`s.
105
- /// - Parameter format: The `Format` to use.
106
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
107
- ///
108
- /// Satisfies conformance to `PatternListBuildable`
109
- func buildPatternList( format: Format , leadingTrivia: Trivia ? = nil ) -> [ PatternSyntax ] {
105
+ /// - Parameter format: The `Format` to use.
106
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
107
+ ///
108
+ /// Satisfies conformance to `PatternListBuildable`
109
+ func buildPatternList( format: Format , leadingTrivia: Trivia ? = nil ) -> [ PatternSyntax ] {
110
110
return [ buildPattern ( format: format, leadingTrivia: leadingTrivia) ]
111
111
}
112
112
/// Builds a `PatternSyntax`.
113
- /// - Parameter format: The `Format` to use.
114
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
115
- /// - Returns: A new `Syntax` with the built `PatternSyntax`.
116
- ///
117
- /// Satisfies conformance to `SyntaxBuildable`.
118
- func buildSyntax( format: Format , leadingTrivia: Trivia ? = nil ) -> Syntax {
113
+ /// - Parameter format: The `Format` to use.
114
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
115
+ /// - Returns: A new `Syntax` with the built `PatternSyntax`.
116
+ ///
117
+ /// Satisfies conformance to `SyntaxBuildable`.
118
+ func buildSyntax( format: Format , leadingTrivia: Trivia ? = nil ) -> Syntax {
119
119
return Syntax ( buildPattern ( format: format, leadingTrivia: leadingTrivia) )
120
120
}
121
121
}
122
122
public protocol StmtListBuildable : SyntaxListBuildable {
123
123
/// Builds list of `StmtSyntax`s.
124
- /// - Parameter format: The `Format` to use.
125
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
126
- func buildStmtList( format: Format , leadingTrivia: Trivia ? ) -> [ StmtSyntax ]
124
+ /// - Parameter format: The `Format` to use.
125
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
126
+ func buildStmtList( format: Format , leadingTrivia: Trivia ? ) -> [ StmtSyntax ]
127
127
}
128
128
public protocol StmtBuildable : ExpressibleAsStmtBuildable , StmtListBuildable , SyntaxBuildable {
129
129
/// Builds list of `StmtSyntax`s.
130
- /// - Parameter format: The `Format` to use.
131
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
132
- func buildStmt( format: Format , leadingTrivia: Trivia ? ) -> StmtSyntax
130
+ /// - Parameter format: The `Format` to use.
131
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
132
+ func buildStmt( format: Format , leadingTrivia: Trivia ? ) -> StmtSyntax
133
133
}
134
134
public extension StmtBuildable {
135
135
/// Satisfies conformance to `ExpressibleAsStmtBuildable`.
136
- func createStmtBuildable( ) -> StmtBuildable {
136
+ func createStmtBuildable( ) -> StmtBuildable {
137
137
return self
138
138
}
139
139
/// Builds list of `StmtSyntax`s.
140
- /// - Parameter format: The `Format` to use.
141
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
142
- ///
143
- /// Satisfies conformance to `StmtListBuildable`
144
- func buildStmtList( format: Format , leadingTrivia: Trivia ? = nil ) -> [ StmtSyntax ] {
140
+ /// - Parameter format: The `Format` to use.
141
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
142
+ ///
143
+ /// Satisfies conformance to `StmtListBuildable`
144
+ func buildStmtList( format: Format , leadingTrivia: Trivia ? = nil ) -> [ StmtSyntax ] {
145
145
return [ buildStmt ( format: format, leadingTrivia: leadingTrivia) ]
146
146
}
147
147
/// Builds a `StmtSyntax`.
148
- /// - Parameter format: The `Format` to use.
149
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
150
- /// - Returns: A new `Syntax` with the built `StmtSyntax`.
151
- ///
152
- /// Satisfies conformance to `SyntaxBuildable`.
153
- func buildSyntax( format: Format , leadingTrivia: Trivia ? = nil ) -> Syntax {
148
+ /// - Parameter format: The `Format` to use.
149
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
150
+ /// - Returns: A new `Syntax` with the built `StmtSyntax`.
151
+ ///
152
+ /// Satisfies conformance to `SyntaxBuildable`.
153
+ func buildSyntax( format: Format , leadingTrivia: Trivia ? = nil ) -> Syntax {
154
154
return Syntax ( buildStmt ( format: format, leadingTrivia: leadingTrivia) )
155
155
}
156
156
}
157
157
public protocol SyntaxListBuildable {
158
158
/// Builds list of `Syntax`s.
159
- /// - Parameter format: The `Format` to use.
160
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
161
- func buildSyntaxList( format: Format , leadingTrivia: Trivia ? ) -> [ Syntax ]
159
+ /// - Parameter format: The `Format` to use.
160
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
161
+ func buildSyntaxList( format: Format , leadingTrivia: Trivia ? ) -> [ Syntax ]
162
162
}
163
163
public protocol SyntaxBuildable : ExpressibleAsSyntaxBuildable , SyntaxListBuildable {
164
164
/// Builds list of `Syntax`s.
165
- /// - Parameter format: The `Format` to use.
166
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
167
- func buildSyntax( format: Format , leadingTrivia: Trivia ? ) -> Syntax
165
+ /// - Parameter format: The `Format` to use.
166
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
167
+ func buildSyntax( format: Format , leadingTrivia: Trivia ? ) -> Syntax
168
168
}
169
169
public extension SyntaxBuildable {
170
170
/// Satisfies conformance to `ExpressibleAsSyntaxBuildable`.
171
- func createSyntaxBuildable( ) -> SyntaxBuildable {
171
+ func createSyntaxBuildable( ) -> SyntaxBuildable {
172
172
return self
173
173
}
174
174
/// Builds list of `Syntax`s.
175
- /// - Parameter format: The `Format` to use.
176
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
177
- ///
178
- /// Satisfies conformance to `SyntaxListBuildable`
179
- func buildSyntaxList( format: Format , leadingTrivia: Trivia ? = nil ) -> [ Syntax ] {
175
+ /// - Parameter format: The `Format` to use.
176
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
177
+ ///
178
+ /// Satisfies conformance to `SyntaxListBuildable`
179
+ func buildSyntaxList( format: Format , leadingTrivia: Trivia ? = nil ) -> [ Syntax ] {
180
180
return [ buildSyntax ( format: format, leadingTrivia: leadingTrivia) ]
181
181
}
182
182
}
183
183
public protocol TypeListBuildable : SyntaxListBuildable {
184
184
/// Builds list of `TypeSyntax`s.
185
- /// - Parameter format: The `Format` to use.
186
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
187
- func buildTypeList( format: Format , leadingTrivia: Trivia ? ) -> [ TypeSyntax ]
185
+ /// - Parameter format: The `Format` to use.
186
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
187
+ func buildTypeList( format: Format , leadingTrivia: Trivia ? ) -> [ TypeSyntax ]
188
188
}
189
189
public protocol TypeBuildable : ExpressibleAsTypeBuildable , TypeListBuildable , SyntaxBuildable {
190
190
/// Builds list of `TypeSyntax`s.
191
- /// - Parameter format: The `Format` to use.
192
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
193
- func buildType( format: Format , leadingTrivia: Trivia ? ) -> TypeSyntax
191
+ /// - Parameter format: The `Format` to use.
192
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
193
+ func buildType( format: Format , leadingTrivia: Trivia ? ) -> TypeSyntax
194
194
}
195
195
public extension TypeBuildable {
196
196
/// Satisfies conformance to `ExpressibleAsTypeBuildable`.
197
- func createTypeBuildable( ) -> TypeBuildable {
197
+ func createTypeBuildable( ) -> TypeBuildable {
198
198
return self
199
199
}
200
200
/// Builds list of `TypeSyntax`s.
201
- /// - Parameter format: The `Format` to use.
202
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
203
- ///
204
- /// Satisfies conformance to `TypeListBuildable`
205
- func buildTypeList( format: Format , leadingTrivia: Trivia ? = nil ) -> [ TypeSyntax ] {
201
+ /// - Parameter format: The `Format` to use.
202
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
203
+ ///
204
+ /// Satisfies conformance to `TypeListBuildable`
205
+ func buildTypeList( format: Format , leadingTrivia: Trivia ? = nil ) -> [ TypeSyntax ] {
206
206
return [ buildType ( format: format, leadingTrivia: leadingTrivia) ]
207
207
}
208
208
/// Builds a `TypeSyntax`.
209
- /// - Parameter format: The `Format` to use.
210
- /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
211
- /// - Returns: A new `Syntax` with the built `TypeSyntax`.
212
- ///
213
- /// Satisfies conformance to `SyntaxBuildable`.
214
- func buildSyntax( format: Format , leadingTrivia: Trivia ? = nil ) -> Syntax {
209
+ /// - Parameter format: The `Format` to use.
210
+ /// - Parameter leadingTrivia: Replaces the last leading trivia if not nil.
211
+ /// - Returns: A new `Syntax` with the built `TypeSyntax`.
212
+ ///
213
+ /// Satisfies conformance to `SyntaxBuildable`.
214
+ func buildSyntax( format: Format , leadingTrivia: Trivia ? = nil ) -> Syntax {
215
215
return Syntax ( buildType ( format: format, leadingTrivia: leadingTrivia) )
216
216
}
217
217
}
0 commit comments