Skip to content

Commit 9faf476

Browse files
committed
Drop label from SyntaxInTree initializer
1 parent d8b0994 commit 9faf476

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Sources/SwiftSyntax/SyntaxChildren.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ struct RawSyntaxChildren: BidirectionalCollection, Sendable {
222222
let offset = startIndex.offset + UInt32(parent.totalLength.utf8Length)
223223
let indexInParent = startIndex.indexInParent + UInt32(parentLayoutView.children.count)
224224
let indexInTree = startIndex.indexInTree.indexInTree + UInt32(parent.totalNodes) - 1
225-
let syntaxIndexInTree = SyntaxIdentifier.SyntaxIndexInTree(indexInTree: indexInTree)
225+
let syntaxIndexInTree = SyntaxIdentifier.SyntaxIndexInTree(indexInTree)
226226
let materialized = SyntaxChildrenIndex(
227227
offset: offset,
228228
indexInParent: indexInParent,

Sources/SwiftSyntax/SyntaxIdentifier.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,22 @@ public struct SyntaxIdentifier: Comparable, Hashable, Sendable {
4747
/// `raw`.
4848
func advancedBy(_ raw: RawSyntax?) -> SyntaxIndexInTree {
4949
let newIndexInTree = self.indexInTree + UInt32(truncatingIfNeeded: raw?.totalNodes ?? 0)
50-
return .init(indexInTree: newIndexInTree)
50+
return .init(newIndexInTree)
5151
}
5252

5353
/// Assuming that this index points to the next sibling of `raw`, reverse it so that it points to the start of
5454
/// `raw`.
5555
func reversedBy(_ raw: RawSyntax?) -> SyntaxIndexInTree {
5656
let newIndexInTree = self.indexInTree - UInt32(truncatingIfNeeded: raw?.totalNodes ?? 0)
57-
return .init(indexInTree: newIndexInTree)
57+
return .init(newIndexInTree)
5858
}
5959

6060
func advancedToFirstChild() -> SyntaxIndexInTree {
6161
let newIndexInTree = self.indexInTree + 1
62-
return .init(indexInTree: newIndexInTree)
62+
return .init(newIndexInTree)
6363
}
6464

65-
init(indexInTree: UInt32) {
65+
init(_ indexInTree: UInt32) {
6666
self.indexInTree = indexInTree
6767
}
6868

@@ -109,7 +109,7 @@ public struct SyntaxIdentifier: Comparable, Hashable, Sendable {
109109
static func forRoot(_ raw: RawSyntax) -> SyntaxIdentifier {
110110
return SyntaxIdentifier(
111111
rootId: Self.rootId(of: raw),
112-
indexInTree: SyntaxIndexInTree(indexInTree: 0)
112+
indexInTree: SyntaxIndexInTree(0)
113113
)
114114
}
115115

@@ -133,7 +133,7 @@ public struct SyntaxIdentifier: Comparable, Hashable, Sendable {
133133
guard !root.hasParent else {
134134
return nil
135135
}
136-
guard indexInTree.indexInTree < SyntaxIndexInTree(indexInTree: 0).advancedBy(root.raw).indexInTree else {
136+
guard indexInTree.indexInTree < SyntaxIndexInTree(0).advancedBy(root.raw).indexInTree else {
137137
return nil
138138
}
139139

0 commit comments

Comments
 (0)