Skip to content

Commit 6a8fb47

Browse files
authored
Merge pull request #2086 from Matejkob/remove-raw-interpolations
Remove all remaining use of `raw:` interpolations
2 parents 39a4239 + 4321d0f commit 6a8fb47

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

CodeGeneration/Sources/SyntaxSupport/Node.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class Node {
5555

5656
/// If the syntax node can be constructed by parsing a string, the parser
5757
/// function that should be invoked to create this node.
58-
public let parserFunction: String?
58+
public let parserFunction: TokenSyntax?
5959

6060
/// A name for this node that is suitable to be used as a variables or enum
6161
/// case's name.
@@ -110,7 +110,7 @@ public class Node {
110110
isExperimental: Bool = false,
111111
nameForDiagnostics: String?,
112112
documentation: String? = nil,
113-
parserFunction: String? = nil,
113+
parserFunction: TokenSyntax? = nil,
114114
traits: [String] = [],
115115
children: [Child] = []
116116
) {
@@ -229,7 +229,7 @@ public class Node {
229229
isExperimental: Bool = false,
230230
nameForDiagnostics: String?,
231231
documentation: String? = nil,
232-
parserFunction: String? = nil,
232+
parserFunction: TokenSyntax? = nil,
233233
elementChoices: [SyntaxNodeKind]
234234
) {
235235
self.kind = kind

CodeGeneration/Sources/generate-swiftsyntax/templates/swiftparser/ParserEntryFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ let parserEntryFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
3939
// incremental parse and would then live in a different arena than
4040
// `parser.arena`.
4141
defer { withExtendedLifetime(parser) {} }
42-
let node = parser.\(raw: parserFunction)()
42+
let node = parser.\(parserFunction)()
4343
let raw = RawSyntax(parser.parseRemainder(into: node))
4444
return Syntax(raw: raw, rawNodeArena: raw.arena).cast(Self.self)
4545
}

CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/RawSyntaxNodesFile.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ let rawSyntaxNodesFile = SourceFileSyntax(leadingTrivia: copyrightHeader) {
172172
}
173173

174174
if let node = node.collectionNode {
175-
let element = node.elementChoices.only != nil ? "\(node.elementChoices.only!.rawType)" : "Element"
175+
let element = node.elementChoices.only != nil ? node.elementChoices.only!.rawType : "Element"
176176
DeclSyntax(
177177
"""
178-
public init(elements: [\(raw: element)], arena: __shared SyntaxArena) {
178+
public init(elements: [\(element)], arena: __shared SyntaxArena) {
179179
let raw = RawSyntax.makeLayout(
180180
kind: .\(node.varOrCaseName), uninitializedCount: elements.count, arena: arena) { layout in
181181
guard var ptr = layout.baseAddress else { return }

CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/SyntaxNodesFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func syntaxNode(emitKind: SyntaxNodeKind) -> SourceFileSyntax {
207207
/// - returns: A copy of the receiver with the provided `\(raw: childElt)`
208208
/// appended to its `\(child.varOrCaseName)` collection.
209209
@available(*, deprecated, message: "Use node.\(child.varOrCaseName).append(newElement) instead")
210-
public func add\(raw: childElt)(_ element: \(raw: childEltType)) -> \(node.kind.syntaxType) {
210+
public func add\(raw: childElt)(_ element: \(childEltType)) -> \(node.kind.syntaxType) {
211211
var collection: RawSyntax
212212
let arena = SyntaxArena()
213213
if let col = raw.layoutView!.children[\(raw: index)] {

0 commit comments

Comments
 (0)