Skip to content

Degyb for nullable PostfixIfConfigExpr.base #297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/SwiftSyntax/gyb_generated/Misc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1968,6 +1968,6 @@ extension Syntax {
extension SyntaxParser {
static func verifyNodeDeclarationHash() -> Bool {
return String(cString: swiftparse_syntax_structure_versioning_identifier()!) ==
"0b9cec009c8c03b20b21615c4b4386bb21ea5a01"
"e9565bceebb81b9c3a69c442a8576b029d7eaf9c"
}
}
3 changes: 0 additions & 3 deletions Sources/SwiftSyntax/gyb_generated/SyntaxBuilders.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2962,9 +2962,6 @@ public struct PostfixIfConfigExprSyntaxBuilder {
}

internal mutating func buildData() -> SyntaxData {
if (layout[0] == nil) {
layout[0] = RawSyntax.missing(SyntaxKind.expr)
}
if (layout[1] == nil) {
layout[1] = RawSyntax.missing(SyntaxKind.ifConfigDecl)
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/SwiftSyntax/gyb_generated/SyntaxFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1418,9 +1418,9 @@ public enum SyntaxFactory {
], length: .zero, presence: .present))
return ObjcSelectorExprSyntax(data)
}
public static func makePostfixIfConfigExpr(base: ExprSyntax, config: IfConfigDeclSyntax) -> PostfixIfConfigExprSyntax {
public static func makePostfixIfConfigExpr(base: ExprSyntax?, config: IfConfigDeclSyntax) -> PostfixIfConfigExprSyntax {
let layout: [RawSyntax?] = [
base.raw,
base?.raw,
config.raw,
]
let raw = RawSyntax.createAndCalcLength(kind: SyntaxKind.postfixIfConfigExpr,
Expand All @@ -1432,7 +1432,7 @@ public enum SyntaxFactory {
public static func makeBlankPostfixIfConfigExpr() -> PostfixIfConfigExprSyntax {
let data = SyntaxData.forRoot(RawSyntax.create(kind: .postfixIfConfigExpr,
layout: [
RawSyntax.missing(SyntaxKind.expr),
nil,
RawSyntax.missing(SyntaxKind.ifConfigDecl),
], length: .zero, presence: .present))
return PostfixIfConfigExprSyntax(data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5275,10 +5275,11 @@ public struct PostfixIfConfigExprSyntax: ExprSyntaxProtocol, SyntaxHashable {
return Swift.type(of: self)
}

public var base: ExprSyntax {
public var base: ExprSyntax? {
get {
let childData = data.child(at: Cursor.base,
parent: Syntax(self))
if childData == nil { return nil }
return ExprSyntax(childData!)
}
set(value) {
Expand All @@ -5291,7 +5292,7 @@ public struct PostfixIfConfigExprSyntax: ExprSyntaxProtocol, SyntaxHashable {
/// current `base`, if present.
public func withBase(
_ newChild: ExprSyntax?) -> PostfixIfConfigExprSyntax {
let raw = newChild?.raw ?? RawSyntax.missing(SyntaxKind.expr)
let raw = newChild?.raw
let newData = data.replacingChild(raw, at: Cursor.base)
return PostfixIfConfigExprSyntax(newData)
}
Expand Down Expand Up @@ -5321,8 +5322,7 @@ public struct PostfixIfConfigExprSyntax: ExprSyntaxProtocol, SyntaxHashable {
public func _validateLayout() {
let rawChildren = Array(RawSyntaxChildren(Syntax(self)))
assert(rawChildren.count == 2)
// Check child #0 child is ExprSyntax
assert(rawChildren[0].raw != nil)
// Check child #0 child is ExprSyntax or missing
if let raw = rawChildren[0].raw {
let info = rawChildren[0].syntaxInfo
let absoluteRaw = AbsoluteRawSyntax(raw: raw, info: info)
Expand All @@ -5345,7 +5345,7 @@ public struct PostfixIfConfigExprSyntax: ExprSyntaxProtocol, SyntaxHashable {
extension PostfixIfConfigExprSyntax: CustomReflectable {
public var customMirror: Mirror {
return Mirror(self, children: [
"base": Syntax(base).asProtocol(SyntaxProtocol.self),
"base": base.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any,
"config": Syntax(config).asProtocol(SyntaxProtocol.self),
])
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/SwiftSyntaxBuilder/gyb_generated/Buildables.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2615,11 +2615,11 @@ public struct ObjcSelectorExpr: ExprBuildable {
}

public struct PostfixIfConfigExpr: ExprBuildable {
let base: ExprBuildable
let base: ExprBuildable?
let config: IfConfigDecl

public init(
base: ExprBuildable,
base: ExprBuildable? = nil,
config: IfConfigDecl
) {
self.base = base
Expand All @@ -2628,7 +2628,7 @@ public struct PostfixIfConfigExpr: ExprBuildable {

func buildPostfixIfConfigExpr(format: Format, leadingTrivia: Trivia? = nil) -> PostfixIfConfigExprSyntax {
let postfixIfConfigExpr = SyntaxFactory.makePostfixIfConfigExpr(
base: base.buildExpr(format: format),
base: base?.buildExpr(format: format),
config: config.buildIfConfigDecl(format: format)
)

Expand Down