Skip to content

Commit ec03e90

Browse files
committed
Generalize VariableDecl convenience initializer
With the new ExpressibleAsExprBuildable: ExpressibleAsInitializerClause conformance we can simplify this convenience initializer and simultaneously make it more expressible by allowing arbitrary initializer clauses.
1 parent 434506b commit ec03e90

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/SwiftSyntaxBuilder/VariableDeclConvenienceInitializers.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ extension VariableDecl {
1717
_ letOrVarKeyword: TokenSyntax,
1818
name: ExpressibleAsIdentifierPattern,
1919
type: ExpressibleAsTypeAnnotation? = nil,
20-
initializer: ExpressibleAsExprBuildable? = nil
20+
initializer: ExpressibleAsInitializerClause? = nil
2121
) {
2222
self.init(letOrVarKeyword: letOrVarKeyword) {
2323
PatternBinding(
2424
pattern: name,
2525
typeAnnotation: type,
26-
initializer: initializer.map { InitializerClause(value: $0) }
26+
initializer: initializer
2727
)
2828
}
2929
}

0 commit comments

Comments
 (0)