Skip to content

Updating ClassDecl to also accept actor #259

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
Feb 11, 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 @@ -1952,6 +1952,6 @@ extension Syntax {
extension SyntaxParser {
static func verifyNodeDeclarationHash() -> Bool {
return String(cString: swiftparse_syntax_structure_versioning_identifier()!) ==
"da7c0141bd1b9360eab92ecfd7c083ae49cd4b1a"
"20b92b603651f0f0f61d43f86e4c706a8a118216"
}
}
4 changes: 2 additions & 2 deletions Sources/SwiftSyntax/gyb_generated/SyntaxBuilders.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3959,8 +3959,8 @@ public struct ClassDeclSyntaxBuilder {
}
}

public mutating func useClassKeyword(_ node: TokenSyntax) {
let idx = ClassDeclSyntax.Cursor.classKeyword.rawValue
public mutating func useClassOrActorKeyword(_ node: TokenSyntax) {
let idx = ClassDeclSyntax.Cursor.classOrActorKeyword.rawValue
layout[idx] = node.raw
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/SwiftSyntax/gyb_generated/SyntaxFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1837,11 +1837,11 @@ public enum SyntaxFactory {
], length: .zero, presence: .present))
return TypeInheritanceClauseSyntax(data)
}
public static func makeClassDecl(attributes: AttributeListSyntax?, modifiers: ModifierListSyntax?, classKeyword: TokenSyntax, identifier: TokenSyntax, genericParameterClause: GenericParameterClauseSyntax?, inheritanceClause: TypeInheritanceClauseSyntax?, genericWhereClause: GenericWhereClauseSyntax?, members: MemberDeclBlockSyntax) -> ClassDeclSyntax {
public static func makeClassDecl(attributes: AttributeListSyntax?, modifiers: ModifierListSyntax?, classOrActorKeyword: TokenSyntax, identifier: TokenSyntax, genericParameterClause: GenericParameterClauseSyntax?, inheritanceClause: TypeInheritanceClauseSyntax?, genericWhereClause: GenericWhereClauseSyntax?, members: MemberDeclBlockSyntax) -> ClassDeclSyntax {
let layout: [RawSyntax?] = [
attributes?.raw,
modifiers?.raw,
classKeyword.raw,
classOrActorKeyword.raw,
identifier.raw,
genericParameterClause?.raw,
inheritanceClause?.raw,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
enum Cursor: Int {
case attributes
case modifiers
case classKeyword
case classOrActorKeyword
case identifier
case genericParameterClause
case inheritanceClause
Expand Down Expand Up @@ -1406,24 +1406,24 @@ public struct ClassDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
return ClassDeclSyntax(newData)
}

public var classKeyword: TokenSyntax {
public var classOrActorKeyword: TokenSyntax {
get {
let childData = data.child(at: Cursor.classKeyword,
let childData = data.child(at: Cursor.classOrActorKeyword,
parent: Syntax(self))
return TokenSyntax(childData!)
}
set(value) {
self = withClassKeyword(value)
self = withClassOrActorKeyword(value)
}
}

/// Returns a copy of the receiver with its `classKeyword` replaced.
/// - param newChild: The new `classKeyword` to replace the node's
/// current `classKeyword`, if present.
public func withClassKeyword(
/// Returns a copy of the receiver with its `classOrActorKeyword` replaced.
/// - param newChild: The new `classOrActorKeyword` to replace the node's
/// current `classOrActorKeyword`, if present.
public func withClassOrActorKeyword(
_ newChild: TokenSyntax?) -> ClassDeclSyntax {
let raw = newChild?.raw ?? RawSyntax.missingToken(TokenKind.classKeyword)
let newData = data.replacingChild(raw, at: Cursor.classKeyword)
let newData = data.replacingChild(raw, at: Cursor.classOrActorKeyword)
return ClassDeclSyntax(newData)
}

Expand Down Expand Up @@ -1614,7 +1614,7 @@ extension ClassDeclSyntax: CustomReflectable {
return Mirror(self, children: [
"attributes": attributes.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any,
"modifiers": modifiers.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any,
"classKeyword": Syntax(classKeyword).asProtocol(SyntaxProtocol.self),
"classOrActorKeyword": Syntax(classOrActorKeyword).asProtocol(SyntaxProtocol.self),
"identifier": Syntax(identifier).asProtocol(SyntaxProtocol.self),
"genericParameterClause": genericParameterClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any,
"inheritanceClause": inheritanceClause.map(Syntax.init)?.asProtocol(SyntaxProtocol.self) as Any,
Expand Down