8000 Modernize hashing · swiftlang/swift-syntax@6591095 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6591095

Browse files
authored
Modernize hashing
Change syntax nodes to implementing hash(into:) instead of hashValue. The latter was deprecated as a protocol requirement in SE-0206.
1 parent d14b06f commit 6591095

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/SwiftSyntax/SyntaxNodes.swift.gyb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ public struct ${node.name}: ${base_type}, _SyntaxBase, Hashable {
145145
return lhs._data === rhs._data
146146
}
147147

148-
/// A unique hash value for this node.
149-
public var hashValue: Int {
150-
return ObjectIdentifier(_data).hashValue
148+
/// Feed the essential parts of this node to the supplied hasher.
149+
public func hash(into hasher: inout Hasher) {
150+
hasher.combine(ObjectIdentifier(_data))
151151
}
152152
}
153153

0 commit comments

Comments
 (0)
0