Skip to content

Commit 285f4f8

Browse files
committed
Rename ImportDeclSyntax.importTok to ImportDeclSyntax.importKeyword
To keep the naming consistent
1 parent b950ac0 commit 285f4f8

File tree

6 files changed

+93
-32
lines changed

6 files changed

+93
-32
lines changed

CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ public let DECL_NODES: [Node] = [
11261126
isOptional: true
11271127
),
11281128
Child(
1129-
name: "ImportTok",
1129+
name: "ImportKeyword",
11301130
kind: .token(choices: [.keyword(text: "import")]),
11311131
documentation: "The `import` keyword for this declaration."
11321132
),

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: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,67 @@ 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+
init(
222+
leadingTrivia: Trivia? = nil,
223+
_ unexpectedBeforeAttributes: UnexpectedNodesSyntax? = nil,
224+
attributes: AttributeListSyntax? = nil,
225+
_ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil,
226+
modifiers: ModifierListSyntax? = nil,
227+
_ unexpectedBetweenModifiersAndImportTok: UnexpectedNodesSyntax? = nil,
228+
importTok: TokenSyntax = .keyword(.import),
229+
_ unexpectedBetweenImportTokAndImportKind: UnexpectedNodesSyntax? = nil,
230+
importKind: TokenSyntax? = nil,
231+
_ unexpectedBetweenImportKindAndPath: UnexpectedNodesSyntax? = nil,
232+
path: ImportPathSyntax,
233+
_ unexpectedAfterPath: UnexpectedNodesSyntax? = nil,
234+
trailingTrivia: Trivia? = nil
235+
) {
236+
self.init(
237+
leadingTrivia: leadingTrivia, unexpectedBeforeAttributes, attributes: attributes,
238+
unexpectedBetweenAttributesAndModifiers,
239+
modifiers: modifiers,
240+
unexpectedBetweenModifiersAndImportTok,
241+
importKeyword: importTok,
242+
unexpectedBetweenImportTokAndImportKind,
243+
importKind: importKind,
244+
unexpectedBetweenImportKindAndPath,
245+
path: path, unexpectedAfterPath,
246+
trailingTrivia: trailingTrivia)
247+
}
248+
}
249+
189250
public extension NamedOpaqueReturnTypeSyntax {
190251
@available(*, deprecated, renamed: "unexpectedBeforeGenericParameterClause")
191252
var unexpectedBeforeGenericParameters: UnexpectedNodesSyntax? {

Sources/SwiftSyntax/generated/ChildNameForKeyPath.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,12 +1723,12 @@ public func childName(_ keyPath: AnyKeyPath) -> String? {
17231723
return "unexpectedBetweenAttributesAndModifiers"
17241724
case \ImportDeclSyntax.modifiers:
17251725
return "modifiers"
1726-
case \ImportDeclSyntax.unexpectedBetweenModifiersAndImportTok:
1727-
return "unexpectedBetweenModifiersAndImportTok"
1728-
case \ImportDeclSyntax.importTok:
1729-
return "importTok"
1730-
case \ImportDeclSyntax.unexpectedBetweenImportTokAndImportKind:
1731-
return "unexpectedBetweenImportTokAndImportKind"
1726+
case \ImportDeclSyntax.unexpectedBetweenModifiersAndImportKeyword:
1727+
return "unexpectedBetweenModifiersAndImportKeyword"
1728+
case \ImportDeclSyntax.importKeyword:
1729+
return "importKeyword"
1730+
case \ImportDeclSyntax.unexpectedBetweenImportKeywordAndImportKind:
1731+
return "unexpectedBetweenImportKeywordAndImportKind"
17321732
case \ImportDeclSyntax.importKind:
17331733
return "importKind"
17341734
case \ImportDeclSyntax.unexpectedBetweenImportKindAndPath:

Sources/SwiftSyntax/generated/raw/RawSyntaxNodes.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11565,9 +11565,9 @@ public struct RawImportDeclSyntax: RawDeclSyntaxNodeProtocol {
1156511565
attributes: RawAttributeListSyntax?,
1156611566
_ unexpectedBetweenAttributesAndModifiers: RawUnexpectedNodesSyntax? = nil,
1156711567
modifiers: RawModifierListSyntax?,
11568-
_ unexpectedBetweenModifiersAndImportTok: RawUnexpectedNodesSyntax? = nil,
11569-
importTok: RawTokenSyntax,
11570-
_ unexpectedBetweenImportTokAndImportKind: RawUnexpectedNodesSyntax? = nil,
11568+
_ unexpectedBetweenModifiersAndImportKeyword: RawUnexpectedNodesSyntax? = nil,
11569+
importKeyword: RawTokenSyntax,
11570+
_ unexpectedBetweenImportKeywordAndImportKind: RawUnexpectedNodesSyntax? = nil,
1157111571
importKind: RawTokenSyntax?,
1157211572
_ unexpectedBetweenImportKindAndPath: RawUnexpectedNodesSyntax? = nil,
1157311573
path: RawImportPathSyntax,
@@ -11581,9 +11581,9 @@ public struct RawImportDeclSyntax: RawDeclSyntaxNodeProtocol {
1158111581
layout[1] = attributes?.raw
1158211582
layout[2] = unexpectedBetweenAttributesAndModifiers?.raw
1158311583
layout[3] = modifiers?.raw
11584-
layout[4] = unexpectedBetweenModifiersAndImportTok?.raw
11585-
layout[5] = importTok.raw
11586-
layout[6] = unexpectedBetweenImportTokAndImportKind?.raw
11584+
layout[4] = unexpectedBetweenModifiersAndImportKeyword?.raw
11585+
layout[5] = importKeyword.raw
11586+
layout[6] = unexpectedBetweenImportKeywordAndImportKind?.raw
1158711587
layout[7] = importKind?.raw
1158811588
layout[8] = unexpectedBetweenImportKindAndPath?.raw
1158911589
layout[9] = path.raw
@@ -11608,15 +11608,15 @@ public struct RawImportDeclSyntax: RawDeclSyntaxNodeProtocol {
1160811608
layoutView.children[3].map(RawModifierListSyntax.init(raw:))
1160911609
}
1161011610

11611-
public var unexpectedBetweenModifiersAndImportTok: RawUnexpectedNodesSyntax? {
11611+
public var unexpectedBetweenModifiersAndImportKeyword: RawUnexpectedNodesSyntax? {
1161211612
layoutView.children[4].map(RawUnexpectedNodesSyntax.init(raw:))
1161311613
}
1161411614

11615-
public var importTok: RawTokenSyntax {
11615+
public var importKeyword: RawTokenSyntax {
1161611616
layoutView.children[5].map(RawTokenSyntax.init(raw:))!
1161711617
}
1161811618

11619-
public var unexpectedBetweenImportTokAndImportKind: RawUnexpectedNodesSyntax? {
11619+
public var unexpectedBetweenImportKeywordAndImportKind: RawUnexpectedNodesSyntax? {
1162011620
layoutView.children[6].map(RawUnexpectedNodesSyntax.init(raw:))
1162111621
}
1162211622

Sources/SwiftSyntax/generated/syntaxNodes/SyntaxDeclNodes.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2917,9 +2917,9 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
29172917
attributes: AttributeListSyntax? = nil,
29182918
_ unexpectedBetweenAttributesAndModifiers: UnexpectedNodesSyntax? = nil,
29192919
modifiers: ModifierListSyntax? = nil,
2920-
_ unexpectedBetweenModifiersAndImportTok: UnexpectedNodesSyntax? = nil,
2921-
importTok: TokenSyntax = .keyword(.import),
2922-
_ unexpectedBetweenImportTokAndImportKind: UnexpectedNodesSyntax? = nil,
2920+
_ unexpectedBetweenModifiersAndImportKeyword: UnexpectedNodesSyntax? = nil,
2921+
importKeyword: TokenSyntax = .keyword(.import),
2922+
_ unexpectedBetweenImportKeywordAndImportKind: UnexpectedNodesSyntax? = nil,
29232923
importKind: TokenSyntax? = nil,
29242924
_ unexpectedBetweenImportKindAndPath: UnexpectedNodesSyntax? = nil,
29252925
path: ImportPathSyntax,
@@ -2934,9 +2934,9 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
29342934
attributes,
29352935
unexpectedBetweenAttributesAndModifiers,
29362936
modifiers,
2937-
unexpectedBetweenModifiersAndImportTok,
2938-
importTok,
2939-
unexpectedBetweenImportTokAndImportKind,
2937+
unexpectedBetweenModifiersAndImportKeyword,
2938+
importKeyword,
2939+
unexpectedBetweenImportKeywordAndImportKind,
29402940
importKind,
29412941
unexpectedBetweenImportKindAndPath,
29422942
path,
@@ -2947,9 +2947,9 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
29472947
attributes?.raw,
29482948
unexpectedBetweenAttributesAndModifiers?.raw,
29492949
modifiers?.raw,
2950-
unexpectedBetweenModifiersAndImportTok?.raw,
2951-
importTok.raw,
2952-
unexpectedBetweenImportTokAndImportKind?.raw,
2950+
unexpectedBetweenModifiersAndImportKeyword?.raw,
2951+
importKeyword.raw,
2952+
unexpectedBetweenImportKeywordAndImportKind?.raw,
29532953
importKind?.raw,
29542954
unexpectedBetweenImportKindAndPath?.raw,
29552955
path.raw,
@@ -3044,7 +3044,7 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
30443044
return ImportDeclSyntax(newData)
30453045
}
30463046

3047-
public var unexpectedBetweenModifiersAndImportTok: UnexpectedNodesSyntax? {
3047+
public var unexpectedBetweenModifiersAndImportKeyword: UnexpectedNodesSyntax? {
30483048
get {
30493049
return data.child(at: 4, parent: Syntax(self)).map(UnexpectedNodesSyntax.init)
30503050
}
@@ -3054,7 +3054,7 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
30543054
}
30553055

30563056
/// The `import` keyword for this declaration.
3057-
public var importTok: TokenSyntax {
3057+
public var importKeyword: TokenSyntax {
30583058
get {
30593059
return TokenSyntax(data.child(at: 5, parent: Syntax(self))!)
30603060
}
@@ -3063,7 +3063,7 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
30633063
}
30643064
}
30653065

3066-
public var unexpectedBetweenImportTokAndImportKind: UnexpectedNodesSyntax? {
3066+
public var unexpectedBetweenImportKeywordAndImportKind: UnexpectedNodesSyntax? {
30673067
get {
30683068
return data.child(at: 6, parent: Syntax(self)).map(UnexpectedNodesSyntax.init)
30693069
}
@@ -3135,9 +3135,9 @@ public struct ImportDeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
31353135
\Self.attributes,
31363136
\Self.unexpectedBetweenAttributesAndModifiers,
31373137
\Self.modifiers,
3138-
\Self.unexpectedBetweenModifiersAndImportTok,
3139-
\Self.importTok,
3140-
\Self.unexpectedBetweenImportTokAndImportKind,
3138+
\Self.unexpectedBetweenModifiersAndImportKeyword,
3139+
\Self.importKeyword,
3140+
\Self.unexpectedBetweenImportKeywordAndImportKind,
31413141
\Self.importKind,
31423142
\Self.unexpectedBetweenImportKindAndPath,
31433143
\Self.path,

0 commit comments

Comments
 (0)