Skip to content

Commit 7813daf

Browse files
committed
Factor out resultBuilderBaseName
1 parent 366da77 commit 7813daf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Sources/SwiftSyntaxBuilderGeneration/SyntaxBuildableType.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,16 @@ struct SyntaxBuildableType: Hashable {
154154
optionalWrapped(type: listBuildableBaseName)
155155
}
156156

157+
/// Assuming that this is a collection type, the non-optional type of the result builder
158+
/// that can be used to build the collection.
159+
var resultBuilderBaseName: String {
160+
"\(syntaxKind)Builder"
161+
}
162+
157163
/// Assuming that this is a collection type, the type of the result builder
158164
/// that can be used to build the collection.
159165
var resultBuilder: ExpressibleAsTypeBuildable {
160-
optionalWrapped(type: "\(syntaxKind)Builder")
166+
optionalWrapped(type: resultBuilderBaseName)
161167
}
162168

163169
/// The collection types in which this type occurs as an element.

0 commit comments

Comments
 (0)