File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
Sources/SwiftSyntaxBuilder/ConvenienceInitializers
Tests/SwiftSyntaxBuilderTest Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -25,9 +25,9 @@ extension VariableDecl {
25
25
) {
26
26
self . init (
27
27
leadingTrivia: leadingTrivia,
28
- attributes: attributes,
28
+ attributes: attributes? . createAttributeList ( ) . withTrailingTrivia ( . space ) ,
29
29
modifiers: modifiers,
30
- letOrVarKeyword: attributes != nil ? letOrVarKeyword . withLeadingTrivia ( . space ) : letOrVarKeyword
30
+ letOrVarKeyword: letOrVarKeyword
31
31
) {
32
32
PatternBinding (
33
33
pattern: name,
@@ -48,9 +48,9 @@ extension VariableDecl {
48
48
) {
49
49
self . init (
50
50
leadingTrivia: leadingTrivia,
51
- attributes: attributes,
51
+ attributes: attributes? . createAttributeList ( ) . withTrailingTrivia ( . space ) ,
52
52
modifiers: modifiers,
53
- letOrVarKeyword: . var. withLeadingTrivia ( attributes != nil ? . space : . zero )
53
+ letOrVarKeyword: . var
54
54
) {
55
55
PatternBinding (
56
56
pattern: name,
Original file line number Diff line number Diff line change @@ -150,6 +150,20 @@ final class VariableTests: XCTestCase {
150
150
}
151
151
"""
152
152
) ,
153
+ #line: (
154
+ VariableDecl (
155
+ attributes: CustomAttribute ( " WithArgs " ) {
156
+ TupleExprElement ( expression: " value " )
157
+ } ,
158
+ modifiers: [ Token . public] ,
159
+ . let,
160
+ name: " z " ,
161
+ type: " Float "
162
+ ) ,
163
+ """
164
+ @WithArgs(value) public let z: Float
165
+ """
166
+ ) ,
153
167
]
154
168
155
169
for (line, testCase) in testCases {
You can’t perform that action at this time.
0 commit comments