@@ -75,13 +75,17 @@ struct SyntaxIndexInTree: Hashable {
75
75
76
76
static var zero : SyntaxIndexInTree = SyntaxIndexInTree ( indexInTree: 0 )
77
77
78
- func advancedBySibling( _ raw: RawSyntax ? ) -> SyntaxIndexInTree {
78
+ /// Assuming that this index points to the start of `Raw`, so that it points
79
+ /// to the next sibling of `Raw`.
80
+ func advancedBy( _ raw: RawSyntax ? ) -> SyntaxIndexInTree {
79
81
let newIndexInTree = self . indexInTree +
80
82
UInt32( truncatingIfNeeded: raw? . totalNodes ?? 0 )
81
83
return . init( indexInTree: newIndexInTree)
82
84
}
83
85
84
- func reversedBySibling( _ raw: RawSyntax ? ) -> SyntaxIndexInTree {
86
+ /// Assuming that this index points to the next sibling of `Raw`, reverse it
87
+ /// so that it points to the start of `Raw`.
88
+ func reversedBy( _ raw: RawSyntax ? ) -> SyntaxIndexInTree {
85
89
let newIndexInTree = self . indexInTree -
86
90
UInt32( truncatingIfNeeded: raw? . totalNodes ?? 0 )
87
91
return . init( indexInTree: newIndexInTree)
@@ -105,12 +109,12 @@ public struct SyntaxIdentifier: Hashable {
105
109
let indexInTree : SyntaxIndexInTree
106
110
107
111
func advancedBySibling( _ raw: RawSyntax ? ) -> SyntaxIdentifier {
108
- let newIndexInTree = indexInTree. advancedBySibling ( raw)
112
+ let newIndexInTree = indexInTree. advancedBy ( raw)
109
113
return . init( rootId: self . rootId, indexInTree: newIndexInTree)
110
114
}
111
115
112
116
func reversedBySibling( _ raw: RawSyntax ? ) -> SyntaxIdentifier {
113
- let newIndexInTree = self . indexInTree. reversedBySibling ( raw)
117
+ let newIndexInTree = self . indexInTree. reversedBy ( raw)
114
118
return . init( rootId: self . rootId, indexInTree: newIndexInTree)
115
119
}
116
120
0 commit comments