Skip to content

Commit a9f4ba2

Browse files
committed
add text parameter to RawTokenSyntax.init(missing:)
1 parent 0b0a2b4 commit a9f4ba2

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Sources/SwiftParser/Expressions.swift

+1-4
Original file line numberDiff line numberDiff line change
@@ -935,11 +935,8 @@ extension Parser {
935935

936936
if let openDelimiter = openDelimiter {
937937
return RawTokenSyntax(
938-
kind: .rawStringDelimiter,
938+
missing: .rawStringDelimiter,
939939
text: openDelimiter.tokenText,
940-
leadingTriviaPieces: [],
941-
trailingTriviaPieces: [],
942-
presence: .missing,
943940
arena: arena
944941
)
945942
}

Sources/SwiftSyntax/Raw/RawSyntaxNodeProtocol.swift

+6-2
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,14 @@ public struct RawTokenSyntax: RawSyntaxNodeProtocol {
158158
/// If `text` is passed, it will be used to represent the missing token's text.
159159
/// If `text` is `nil`, the `kind`'s default text will be used.
160160
/// If that is also `nil`, the token will have empty text.
161-
public init(missing kind: RawTokenKind, arena: __shared SyntaxArena) {
161+
public init(
162+
missing kind: RawTokenKind,
163+
text: SyntaxText? = nil,
164+
arena: __shared SyntaxArena
165+
) {
162166
self.init(
163167
kind: kind,
164-
text: kind.defaultText ?? "",
168+
text: text ?? kind.defaultText ?? "",
165169
leadingTriviaPieces: [],
166170
trailingTriviaPieces: [],
167171
presence: .missing,

0 commit comments

Comments
 (0)