@@ -64,8 +64,8 @@ struct AbsoluteSyntaxInfo {
64
64
return . init( position: newPosition, nodeId: newNodeId)
65
65
}
66
66
67
- static func forRoot( _ raw : RawSyntax ) -> AbsoluteSyntaxInfo {
68
- return . init( position: . forRoot, nodeId: . forRoot ( raw ) )
67
+ static var forRoot : AbsoluteSyntaxInfo {
68
+ return . init( position: . forRoot, nodeId: . newRoot ( ) )
69
69
}
70
70
}
71
71
@@ -104,7 +104,7 @@ struct SyntaxIndexInTree: Hashable {
104
104
/// Provides a stable and unique identity for `Syntax` nodes.
105
105
public struct SyntaxIdentifier : Hashable {
106
106
/// Unique value for each root node created.
107
- let rootId : UInt
107
+ let rootId : UInt32
108
108
/// Unique value for a node within its own tree.
109
109
let indexInTree : SyntaxIndexInTree
110
110
@@ -123,8 +123,8 @@ public struct SyntaxIdentifier: Hashable {
123
123
return . init( rootId: self . rootId, indexInTree: newIndexInTree)
124
124
}
125
125
126
- static func forRoot ( _ raw : RawSyntax ) -> SyntaxIdentifier {
127
- return . init( rootId: UInt ( bitPattern : raw . pointer ) ,
126
+ static func newRoot ( ) -> SyntaxIdentifier {
127
+ return . init( rootId: UInt32 ( truncatingIfNeeded : AtomicCounter . next ( ) ) ,
128
128
indexInTree: . zero)
129
129
}
130
130
}
@@ -168,14 +168,14 @@ struct AbsoluteRawSyntax {
168
168
return nil
169
169
}
170
170
171
- func replacingSelf( _ newRaw: RawSyntax , newRootId: UInt ) -> AbsoluteRawSyntax {
171
+ func replacingSelf( _ newRaw: RawSyntax , newRootId: UInt32 ) -> AbsoluteRawSyntax {
172
172
let nodeId = SyntaxIdentifier ( rootId: newRootId, indexInTree: info. nodeId. indexInTree)
173
173
let newInfo = AbsoluteSyntaxInfo ( position: info. position, nodeId: nodeId)
174
174
return . init( raw: newRaw, info: newInfo)
175
175
}
176
176
177
177
static func forRoot( _ raw: RawSyntax ) -> AbsoluteRawSyntax {
178
- return . init( raw: raw, info: . forRoot( raw ) )
178
+ return . init( raw: raw, info: . forRoot)
179
179
}
180
180
}
181
181
0 commit comments