Skip to content

Commit 1f36d0f

Browse files
committed
Rename ImportDeclSyntax.importTok to ImportDeclSyntax.importKeyword
To keep the naming consistent
1 parent 07361ba commit 1f36d0f

File tree

6 files changed

+94
-32
lines changed

6 files changed

+94
-32
lines changed

CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ public let DECL_NODES: [Node] = [
12001200
isOptional: true
12011201
),
12021202
Child(
1203-
name: "ImportTok",
1203+
name: "ImportKeyword",
12041204
kind: .token(choices: [.keyword(text: "import")]),
12051205
documentation: "The `import` keyword for this declaration."
12061206
),

Sources/SwiftParser/Declarations.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ extension Parser {
331331
attributes: attrs.attributes,
332332
modifiers: attrs.modifiers,
333333
unexpectedBeforeImportKeyword,
334-
importTok: importKeyword,
334+
importKeyword: importKeyword,
335335
importKind: kind,
336336
path: path,
337337
arena: self.arena

Sources/SwiftSyntax/SwiftSyntaxCompatibility.swift

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,68 @@ public extension FunctionTypeSyntax {
186186
}
187187
}
188188

189+
public extension ImportDeclSyntax {
190+
@available(*, deprecated, renamed: "unexpectedBetweenModifiersAndImportKeyword")
191+
var unexpectedBetweenModifiersAndImportTok: UnexpectedNodesSyntax? {
192+
get {
193+
return unexpectedBetweenModifiersAndImportKeyword
194+
}
195+
set(value) {
196+
unexpectedBetweenModifiersAndImportKeyword = value
197+
}
198+
}
199+
200+
@available(*, deprecated, renamed: "importKeyword")
201+
var importTok: TokenSyntax {
202+
get {
203+
return importKeyword
204+
}
205+
set(value) {
206+
importKeyword = value
207+
}
208+
}
209+
210+
@available(*, deprecated, renamed: "unexpectedBetweenImportKeywordAndImportKind")
211+
var unexpectedBetweenImportTokAndImportKind: UnexpectedNodesSyntax? {
212+
get {
213+
return unexpectedBetweenImportKeywordAndImportKind
214+
}
215+
set(value) {
216+
unexpectedBetweenImportKeywordAndImportKind = value
217+
}
218+
}
219+
220+
@available(*, deprecated, message: "Use an initializer with importKeyword")
221+
@_disfavoredOverload
222+
init(
223+
leadingTrivia: Trivia? = nil,
224+
_ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil,
225+
attributes: AttributeListSyntax? = nil,
226+
_ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil,
227+
modifiers: ModifierListSyntax? = nil,
228+
_ unexpectedBetweenModifiersAndImportTok: UnexpectedNodesSyntax? = nil,
229+
importTok: TokenSyntax = .keyword(.import),
230+
_ unexpectedBetweenImportTokAndImportKind: UnexpectedNodesSyntax? = nil,
231+
importKind: TokenSyntax? = nil,
232+
_ unexpectedBetweenImportKindAndPath: UnexpectedNodesSyntax? = nil,
233+
path: ImportPathSyntax,
234+
_ unexpectedAfterPath: UnexpectedNodesSyntax? = nil,
235+
trailingTrivia: Trivia? = nil
236+
) {
237+
self.init(
238+
leadingTrivia: leadingTrivia, unexpectedBeforeAttributes, attributes: attributes,
239+
unexpectedBetweenAttributesAndModifiers,
240+
modifiers: modifiers,
241+
unexpectedBetweenModifiersAndImportTok,
242+
importKeyword: importTok,
243+
unexpectedBetweenImportTokAndImportKind,
244+
importKind: importKind,
245+
unexpectedBetweenImportKindAndPath,
246+
path: path, unexpectedAfterPath,
247+
trailingTrivia: trailingTrivia)
248+
}
249+
}
250+
189251
public extension NamedOpaqueReturnTypeSyntax {
190252
@available(*, deprecated, renamed: "unexpectedBeforeGenericParameterClause")
191253
var unexpectedBeforeGenericParameters: UnexpectedNodesSyntax? {

Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,12 +1755,12 @@ public func childName(_ keyPath: AnyKeyPath) -> String? {
17551755
return "unexpectedBetweenAttributesAndModifiers"
17561756
case \ImportDeclSyntax.modifiers:
17571757
return "modifiers"
1758-
case \ImportDeclSyntax.unexpectedBetweenModifiersAndImportTok:
1759-
return "unexpectedBetweenModifiersAndImportTok"
1760-
case \ImportDeclSyntax.importTok:
1761-
return "importTok"
1762-
case \ImportDeclSyntax.unexpectedBetweenImportTokAndImportKind:
1763-
return "unexpectedBetweenImportTokAndImportKind"
1758+
case \ImportDeclSyntax.unexpectedBetweenModifiersAndImportKeyword:
1759+
return "unexpectedBetweenModifiersAndImportKeyword"
1760+
case \ImportDeclSyntax.importKeyword:
1761+
return "importKeyword"
1762+
case \ImportDeclSyntax.unexpectedBetweenImportKeywordAndImportKind:
1763+
return "unexpectedBetweenImportKeywordAndImportKind"
17641764
case \ImportDeclSyntax.importKind:
17651765
return "importKind"
17661766
case \ImportDeclSyntax.unexpectedBetweenImportKindAndPath:

Sources/SwiftSyntax/generated/raw/RawSyntaxNodes.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11741,9 +11741,9 @@ public struct RawImportDeclSyntax: RawDeclSyntaxNodeProtocol {
1174111741
attributes: RawAttributeListSyntax?,
1174211742
_ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil,
1174311743
modifiers: RawModifierListSyntax?,
11744-
_ unexpectedBetweenModifiersAndImportTok: RawUnexpectedNodesSyntax? = nil,
11745-
importTok: RawTokenSyntax,
11746-
_ unexpectedBetweenImportTokAndImportKind: RawUnexpectedNodesSyntax? = nil,
11744+
_ unexpectedBetweenModifiersAndImportKeyword: RawUnexpectedNodesSyntax? = nil,
11745+
importKeyword: RawTokenSyntax,
11746+
_ unexpectedBetweenImportKeywordAndImportKind: RawUnexpectedNodesSyntax? = nil,
1174711747
importKind: RawTokenSyntax?,
1174811748
_ unexpectedBetweenImportKindAndPath: RawUnexpectedNodesSyntax? = nil,
1174911749
path: RawImportPathSyntax,
@@ -11757,9 +11757,9 @@ public struct RawImportDeclSyntax: RawDeclSyntaxNodeProtocol {
1175711757
layout[1] = attributes?.raw
1175811758
layout[2] = unexpectedBetweenAttributesAndModifiers?.raw
1175911759
layout[3] = modifiers?.raw
11760-
layout[4] = unexpectedBetweenModifiersAndImportTok?.raw
11761-
layout[5] = importTok.raw
11762-
layout[6] = unexpectedBetweenImportTokAndImportKind?.raw
11760+
layout[4] = unexpectedBetweenModifiersAndImportKeyword?.raw
11761+
layout[5] = importKeyword.raw
11762+
layout[6] = unexpectedBetweenImportKeywordAndImportKind?.raw
1176311763
layout[7] = importKind?.raw
1176411764
layout[8] = unexpectedBetweenImportKindAndPath?.raw
1176511765
layout[9] = path.raw
@@ -11784,15 +11784,15 @@ public struct RawImportDeclSyntax: RawDeclSyntaxNodeProtocol {
1178411784
layoutView.children[3].map(RawModifierListSyntax.init(raw:))
1178511785
}
1178611786

11787-
public var unexpectedBetweenModifiersAndImportTok: RawUnexpectedNodesSyntax? {
11787+
public var unexpectedBetweenModifiersAndImportKeyword: RawUnexpectedNodesSyntax? {
1178811788
layoutView.children[4].map(RawUnexpectedNodesSyntax.init(raw:))
1178911789
}
1179011790

11791-
public var importTok: RawTokenSyntax {
11791+
public var importKeyword: RawTokenSyntax {
1179211792
layoutView.children[5].map(RawTokenSyntax.init(raw:))!
1179311793
}
1179411794

11795-
public var unexpectedBetweenImportTokAndImportKind: RawUnexpectedNodesSyntax? {
11795+
public var unexpectedBetweenImportKeywordAndImportKind: RawUnexpectedNodesSyntax? {
1179611796
layoutView.children[6].map(RawUnexpectedNodesSyntax.init(raw:))
1179711797
}
1179811798

Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2943,9 +2943,9 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
29432943
attributes: AttributeListSyntax? = nil,
29442944
_ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil,
29452945
modifiers: ModifierListSyntax? = nil,
2946-
_ unexpectedBetweenModifiersAndImportTok: UnexpectedNodesSyntax? = nil,
2947-
importTok: TokenSyntax = .keyword(.import),
2948-
_ unexpectedBetweenImportTokAndImportKind: UnexpectedNodesSyntax? = nil,
2946+
_ unexpectedBetweenModifiersAndImportKeyword: UnexpectedNodesSyntax? = nil,
2947+
importKeyword: TokenSyntax = .keyword(.import),
2948+
_ unexpectedBetweenImportKeywordAndImportKind: UnexpectedNodesSyntax? = nil,
29492949
importKind: TokenSyntax? = nil,
29502950
_ unexpectedBetweenImportKindAndPath: UnexpectedNodesSyntax? = nil,
29512951
path: ImportPathSyntax,
@@ -2960,9 +2960,9 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
29602960
attributes,
29612961
unexpectedBetweenAttributesAndModifiers,
29622962
modifiers,
2963-
unexpectedBetweenModifiersAndImportTok,
2964-
importTok,
2965-
unexpectedBetweenImportTokAndImportKind,
2963+
unexpectedBetweenModifiersAndImportKeyword,
2964+
importKeyword,
2965+
unexpectedBetweenImportKeywordAndImportKind,
29662966
importKind,
29672967
unexpectedBetweenImportKindAndPath,
29682968
path,
@@ -2973,9 +2973,9 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
29732973
attributes?.raw,
29742974
unexpectedBetweenAttributesAndModifiers?.raw,
29752975
modifiers?.raw,
2976-
unexpectedBetweenModifiersAndImportTok?.raw,
2977-
importTok.raw,
2978-
unexpectedBetweenImportTokAndImportKind?.raw,
2976+
unexpectedBetweenModifiersAndImportKeyword?.raw,
2977+
importKeyword.raw,
2978+
unexpectedBetweenImportKeywordAndImportKind?.raw,
29792979
importKind?.raw,
29802980
unexpectedBetweenImportKindAndPath?.raw,
29812981
path.raw,
@@ -3070,7 +3070,7 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
30703070
return ImportDeclSyntax(newData)
30713071
}
30723072

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

30823082
/// The `import` keyword for this declaration.
3083-
public var importTok: TokenSyntax {
3083+
public var importKeyword: TokenSyntax {
30843084
get {
30853085
return TokenSyntax(data.child(at: 5, parent: Syntax(self))!)
30863086
}
@@ -3089,7 +3089,7 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
30893089
}
30903090
}
30913091

3092-
public var unexpectedBetweenImportTokAndImportKind: UnexpectedNodesSyntax? {
3092+
public var unexpectedBetweenImportKeywordAndImportKind: UnexpectedNodesSyntax? {
30933093
get {
30943094
return data.child(at: 6, parent: Syntax(self)).map(UnexpectedNodesSyntax.init)
30953095
}
@@ -3161,9 +3161,9 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
31613161
\Self.attributes,
31623162
\Self.unexpectedBetweenAttributesAndModifiers,
31633163
\Self.modifiers,
3164-
\Self.unexpectedBetweenModifiersAndImportTok,
3165-
\Self.importTok,
3166-
\Self.unexpectedBetweenImportTokAndImportKind,
3164+
\Self.unexpectedBetweenModifiersAndImportKeyword,
3165+
\Self.importKeyword,
3166+
\Self.unexpectedBetweenImportKeywordAndImportKind,
31673167
\Self.importKind,
31683168
\Self.unexpectedBetweenImportKindAndPath,
31693169
\Self.path,

0 commit comments

Comments
 (0)