Skip to content

Rename ImportDeclSyntax.importTok to ImportDeclSyntax.importKeyword #1728

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
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 CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ public let DECL_NODES: [Node] = [
isOptional: true
),
Child(
name: "ImportTok",
name: "ImportKeyword",
kind: .token(choices: [.keyword(text: "import")]),
documentation: "The `import` keyword for this declaration."
),
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftParser/Declarations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ extension Parser {
attributes: attrs.attributes,
modifiers: attrs.modifiers,
unexpectedBeforeImportKeyword,
importTok: importKeyword,
importKeyword: importKeyword,
importKind: kind,
path: path,
arena: self.arena
Expand Down
111 changes: 91 additions & 20 deletions Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,27 @@ public extension DeclGroupSyntax {
}
}

public extension EditorPlaceholderDeclSyntax {
@available(*, deprecated, renamed: "placeholder")
var identifier: TokenSyntax { placeholder }

@available(*, deprecated, renamed: "placeholder")
@_disfavoredOverload
init(
leadingTrivia: Trivia? = nil,
_ unexpectedBeforeIdentifier: UnexpectedNodesSyntax? = nil,
identifier: TokenSyntax,
_ unexpectedAfterIdentifier: UnexpectedNodesSyntax? = nil
) {
self.init(
leadingTrivia: leadingTrivia,
unexpectedBeforeIdentifier,
placeholder: identifier,
unexpectedAfterIdentifier
)
}
}

public extension EnumDeclSyntax {
@available(*, deprecated, renamed: "unexpectedBetweenIdentifierAndGenericParameterClause")
var unexpectedBetweenIdentifierAndGenericParameters: UnexpectedNodesSyntax? {
Expand Down Expand Up @@ -66,6 +87,7 @@ public extension EnumDeclSyntax {
}

@available(*, deprecated, message: "Use an initializer with a genericParameterClause argument.")
@_disfavoredOverload
init(
leadingTrivia: Trivia? = nil,
_ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil,
Expand Down Expand Up @@ -153,6 +175,7 @@ public extension FunctionTypeSyntax {
}

@available(*, deprecated, message: "Use an initializer with a parameters")
@_disfavoredOverload
init(
leadingTrivia: Trivia? = nil,
_ unexpectedBeforeLeftParen: UnexpectedNodesSyntax? = nil,
Expand Down Expand Up @@ -186,6 +209,72 @@ public extension FunctionTypeSyntax {
}
}

public extension ImportDeclSyntax {
@available(*, deprecated, renamed: "unexpectedBetweenModifiersAndImportKeyword")
var unexpectedBetweenModifiersAndImportTok: UnexpectedNodesSyntax? {
get {
return unexpectedBetweenModifiersAndImportKeyword
}
set(value) {
unexpectedBetweenModifiersAndImportKeyword = value
}
}

@available(*, deprecated, renamed: "importKeyword")
var importTok: TokenSyntax {
get {
return importKeyword
}
set(value) {
importKeyword = value
}
}

@available(*, deprecated, renamed: "unexpectedBetweenImportKeywordAndImportKind")
var unexpectedBetweenImportTokAndImportKind: UnexpectedNodesSyntax? {
get {
return unexpectedBetweenImportKeywordAndImportKind
}
set(value) {
unexpectedBetweenImportKeywordAndImportKind = value
}
}

@available(*, deprecated, message: "Use an initializer with importKeyword")
@_disfavoredOverload
init(
leadingTrivia: Trivia? = nil,
_ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil,
attributes: AttributeListSyntax? = nil,
_ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil,
modifiers: ModifierListSyntax? = nil,
_ unexpectedBetweenModifiersAndImportTok: UnexpectedNodesSyntax? = nil,
importTok: TokenSyntax = .keyword(.import),
_ unexpectedBetweenImportTokAndImportKind: UnexpectedNodesSyntax? = nil,
importKind: TokenSyntax? = nil,
_ unexpectedBetweenImportKindAndPath: UnexpectedNodesSyntax? = nil,
path: ImportPathSyntax,
_ unexpectedAfterPath: UnexpectedNodesSyntax? = nil,
trailingTrivia: Trivia? = nil
) {
self.init(
leadingTrivia: leadingTrivia,
unexpectedBeforeAttributes,
attributes: attributes,
unexpectedBetweenAttributesAndModifiers,
modifiers: modifiers,
unexpectedBetweenModifiersAndImportTok,
importKeyword: importTok,
unexpectedBetweenImportTokAndImportKind,
importKind: importKind,
unexpectedBetweenImportKindAndPath,
path: path,
unexpectedAfterPath,
trailingTrivia: trailingTrivia
)
}
}

public extension NamedOpaqueReturnTypeSyntax {
@available(*, deprecated, renamed: "unexpectedBeforeGenericParameterClause")
var unexpectedBeforeGenericParameters: UnexpectedNodesSyntax? {
Expand Down Expand Up @@ -218,6 +307,7 @@ public extension NamedOpaqueReturnTypeSyntax {
}

@available(*, deprecated, message: "Use an initializer with a genericParameterClause argument.")
@_disfavoredOverload
init(
leadingTrivia: Trivia? = nil,
_ unexpectedBeforeGenericParameters: UnexpectedNodesSyntax? = nil,
Expand Down Expand Up @@ -271,6 +361,7 @@ public extension TupleExprSyntax {
}

@available(*, deprecated, message: "Use an initializer with a elements argument")
@_disfavoredOverload
init(
leadingTrivia: Trivia? = nil,
_ unexpectedBeforeLeftParen: UnexpectedNodesSyntax? = nil,
Expand All @@ -295,23 +386,3 @@ public extension TupleExprSyntax {
)
}
}

public extension EditorPlaceholderDeclSyntax {
@available(*, deprecated, renamed: "placeholder")
var identifier: TokenSyntax { placeholder }

@available(*, deprecated, renamed: "placeholder")
init(
leadingTrivia: Trivia? = nil,
_ unexpectedBeforeIdentifier: UnexpectedNodesSyntax? = nil,
identifier: TokenSyntax,
_ unexpectedAfterIdentifier: UnexpectedNodesSyntax? = nil
) {
self.init(
leadingTrivia: leadingTrivia,
unexpectedBeforeIdentifier,
placeholder: identifier,
unexpectedAfterIdentifier
)
}
}
12 changes: 6 additions & 6 deletions Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1755,12 +1755,12 @@ public func childName(_ keyPath: AnyKeyPath) -> String? {
return "unexpectedBetweenAttributesAndModifiers"
case \ImportDeclSyntax.modifiers:
return "modifiers"
case \ImportDeclSyntax.unexpectedBetweenModifiersAndImportTok:
return "unexpectedBetweenModifiersAndImportTok"
case \ImportDeclSyntax.importTok:
return "importTok"
case \ImportDeclSyntax.unexpectedBetweenImportTokAndImportKind:
return "unexpectedBetweenImportTokAndImportKind"
case \ImportDeclSyntax.unexpectedBetweenModifiersAndImportKeyword:
return "unexpectedBetweenModifiersAndImportKeyword"
case \ImportDeclSyntax.importKeyword:
return "importKeyword"
case \ImportDeclSyntax.unexpectedBetweenImportKeywordAndImportKind:
return "unexpectedBetweenImportKeywordAndImportKind"
case \ImportDeclSyntax.importKind:
return "importKind"
case \ImportDeclSyntax.unexpectedBetweenImportKindAndPath:
Expand Down
18 changes: 9 additions & 9 deletions Sources/SwiftSyntax/generated/raw/RawSyntaxNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11741,9 +11741,9 @@ public struct RawImportDeclSyntax: RawDeclSyntaxNodeProtocol {
attributes: RawAttributeListSyntax?,
_ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil,
modifiers: RawModifierListSyntax?,
_ unexpectedBetweenModifiersAndImportTok: RawUnexpectedNodesSyntax? = nil,
importTok: RawTokenSyntax,
_ unexpectedBetweenImportTokAndImportKind: RawUnexpectedNodesSyntax? = nil,
_ unexpectedBetweenModifiersAndImportKeyword: RawUnexpectedNodesSyntax? = nil,
importKeyword: RawTokenSyntax,
_ unexpectedBetweenImportKeywordAndImportKind: RawUnexpectedNodesSyntax? = nil,
importKind: RawTokenSyntax?,
_ unexpectedBetweenImportKindAndPath: RawUnexpectedNodesSyntax? = nil,
path: RawImportPathSyntax,
Expand All @@ -11757,9 +11757,9 @@ public struct RawImportDeclSyntax: RawDeclSyntaxNodeProtocol {
layout[1] = attributes?.raw
layout[2] = unexpectedBetweenAttributesAndModifiers?.raw
layout[3] = modifiers?.raw
layout[4] = unexpectedBetweenModifiersAndImportTok?.raw
layout[5] = importTok.raw
layout[6] = unexpectedBetweenImportTokAndImportKind?.raw
layout[4] = unexpectedBetweenModifiersAndImportKeyword?.raw
layout[5] = importKeyword.raw
layout[6] = unexpectedBetweenImportKeywordAndImportKind?.raw
layout[7] = importKind?.raw
layout[8] = unexpectedBetweenImportKindAndPath?.raw
layout[9] = path.raw
Expand All @@ -11784,15 +11784,15 @@ public struct RawImportDeclSyntax: RawDeclSyntaxNodeProtocol {
layoutView.children[3].map(RawModifierListSyntax.init(raw:))
}

public var unexpectedBetweenModifiersAndImportTok: RawUnexpectedNodesSyntax? {
public var unexpectedBetweenModifiersAndImportKeyword: RawUnexpectedNodesSyntax? {
layoutView.children[4].map(RawUnexpectedNodesSyntax.init(raw:))
}

public var importTok: RawTokenSyntax {
public var importKeyword: RawTokenSyntax {
layoutView.children[5].map(RawTokenSyntax.init(raw:))!
}

public var unexpectedBetweenImportTokAndImportKind: RawUnexpectedNodesSyntax? {
public var unexpectedBetweenImportKeywordAndImportKind: RawUnexpectedNodesSyntax? {
layoutView.children[6].map(RawUnexpectedNodesSyntax.init(raw:))
}

Expand Down
30 changes: 15 additions & 15 deletions Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2943,9 +2943,9 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
attributes: AttributeListSyntax? = nil,
_ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil,
modifiers: ModifierListSyntax? = nil,
_ unexpectedBetweenModifiersAndImportTok: UnexpectedNodesSyntax? = nil,
importTok: TokenSyntax = .keyword(.import),
_ unexpectedBetweenImportTokAndImportKind: UnexpectedNodesSyntax? = nil,
_ unexpectedBetweenModifiersAndImportKeyword: UnexpectedNodesSyntax? = nil,
importKeyword: TokenSyntax = .keyword(.import),
_ unexpectedBetweenImportKeywordAndImportKind: UnexpectedNodesSyntax? = nil,
importKind: TokenSyntax? = nil,
_ unexpectedBetweenImportKindAndPath: UnexpectedNodesSyntax? = nil,
path: ImportPathSyntax,
Expand All @@ -2960,9 +2960,9 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
attributes,
unexpectedBetweenAttributesAndModifiers,
modifiers,
unexpectedBetweenModifiersAndImportTok,
importTok,
unexpectedBetweenImportTokAndImportKind,
unexpectedBetweenModifiersAndImportKeyword,
importKeyword,
unexpectedBetweenImportKeywordAndImportKind,
importKind,
unexpectedBetweenImportKindAndPath,
path,
Expand All @@ -2973,9 +2973,9 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
attributes?.raw,
unexpectedBetweenAttributesAndModifiers?.raw,
modifiers?.raw,
unexpectedBetweenModifiersAndImportTok?.raw,
importTok.raw,
unexpectedBetweenImportTokAndImportKind?.raw,
unexpectedBetweenModifiersAndImportKeyword?.raw,
importKeyword.raw,
unexpectedBetweenImportKeywordAndImportKind?.raw,
importKind?.raw,
unexpectedBetweenImportKindAndPath?.raw,
path.raw,
Expand Down Expand Up @@ -3070,7 +3070,7 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
return ImportDeclSyntax(newData)
}

public var unexpectedBetweenModifiersAndImportTok: UnexpectedNodesSyntax? {
public var unexpectedBetweenModifiersAndImportKeyword: UnexpectedNodesSyntax? {
get {
return data.child(at: 4, parent: Syntax(self)).map(UnexpectedNodesSyntax.init)
}
Expand All @@ -3080,7 +3080,7 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
}

/// The `import` keyword for this declaration.
public var importTok: TokenSyntax {
public var importKeyword: TokenSyntax {
get {
return TokenSyntax(data.child(at: 5, parent: Syntax(self))!)
}
Expand All @@ -3089,7 +3089,7 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
}
}

public var unexpectedBetweenImportTokAndImportKind: UnexpectedNodesSyntax? {
public var unexpectedBetweenImportKeywordAndImportKind: UnexpectedNodesSyntax? {
get {
return data.child(at: 6, parent: Syntax(self)).map(UnexpectedNodesSyntax.init)
}
Expand Down Expand Up @@ -3161,9 +3161,9 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
\Self.attributes,
\Self.unexpectedBetweenAttributesAndModifiers,
\Self.modifiers,
\Self.unexpectedBetweenModifiersAndImportTok,
\Self.importTok,
\Self.unexpectedBetweenImportTokAndImportKind,
\Self.unexpectedBetweenModifiersAndImportKeyword,
\Self.importKeyword,
\Self.unexpectedBetweenImportKeywordAndImportKind,
\Self.importKind,
\Self.unexpectedBetweenImportKindAndPath,
\Self.path,
Expand Down