Skip to content

Commit 117b293

Browse files
committed
Avoid using the name defaultInitialization differently
1 parent f9f208e commit 117b293

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

CodeGeneration/Sources/Utils/SyntaxBuildableChild.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public extension Child {
5353
return InitializerClauseSyntax(value: NilLiteralExprSyntax())
5454
}
5555
guard let token = token, isToken else {
56-
return type.defaultInitialization.map { InitializerClauseSyntax(value: $0) }
56+
return type.defaultValue.map { InitializerClauseSyntax(value: $0) }
5757
}
5858
if token.isKeyword {
5959
return InitializerClauseSyntax(value: ExprSyntax(".\(raw: token.swiftKind)()"))

CodeGeneration/Sources/Utils/SyntaxBuildableNode.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public extension Node {
5050

5151
/// Assuming this node has a single child without a default value, that child.
5252
var singleNonDefaultedChild: Child {
53-
let nonDefaultedParams = children.filter { $0.type.defaultInitialization == nil }
53+
let nonDefaultedParams = children.filter { $0.defaultInitialization == nil }
5454
precondition(nonDefaultedParams.count == 1)
5555
return nonDefaultedParams[0]
5656
}

CodeGeneration/Sources/Utils/SyntaxBuildableType.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@ public struct SyntaxBuildableType: Hashable {
5050
}
5151

5252
/// 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? {
5756
if isOptional {
5857
return ExprSyntax(NilLiteralExprSyntax())
5958
} else if let token = token {

0 commit comments

Comments
 (0)