File tree Expand file tree Collapse file tree 3 files changed +5
-6
lines changed
CodeGeneration/Sources/Utils Expand file tree Collapse file tree 3 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ public extension Child {
53
53
return InitializerClauseSyntax ( value: NilLiteralExprSyntax ( ) )
54
54
}
55
55
guard let token = token, isToken else {
56
- return type. defaultInitialization . map { InitializerClauseSyntax ( value: $0) }
56
+ return type. defaultValue . map { InitializerClauseSyntax ( value: $0) }
57
57
}
58
58
if token. isKeyword {
59
59
return InitializerClauseSyntax ( value: ExprSyntax ( " . \( raw: token. swiftKind) () " ) )
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ public extension Node {
50
50
51
51
/// Assuming this node has a single child without a default value, that child.
52
52
var singleNonDefaultedChild : Child {
53
- let nonDefaultedParams = children. filter { $0. type . defaultInitialization == nil }
53
+ let nonDefaultedParams = children. filter { $0. defaultInitialization == nil }
54
54
precondition ( nonDefaultedParams. count == 1 )
55
55
return nonDefaultedParams [ 0 ]
56
56
}
Original file line number Diff line number Diff line change @@ -50,10 +50,9 @@ public struct SyntaxBuildableType: Hashable {
50
50
}
51
51
52
52
/// If the type has a default value (because it is optional or a token
53
- /// with fixed test), return an expression of the form ` = defaultValue`
54
- /// that can be used as the default value for a function parameter.
55
- /// Otherwise, return the empty string.
56
- public var defaultInitialization : ExprSyntax ? {
53
+ /// with fixed test), return an expression that can be used as the
54
+ /// default value for a function parameter. Otherwise, return `nil`.
55
+ public var defaultValue : ExprSyntax ? {
57
56
if isOptional {
58
57
return ExprSyntax ( NilLiteralExprSyntax ( ) )
59
58
} else if let token = token {
You can’t perform that action at this time.
0 commit comments