mirror of
https://github.com/apple/swift-collections
synced 2026-11-30 05:18:44 +00:00
Remove _Rope._leaf(at:)
This commit is contained in:
2 files changed
+11
-23
No files matched your search
@@ -365,7 +365,17 @@ extension _Rope.Node {
|
||||
}
|
||||
return asUnmanagedLeaf
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension _Rope {
|
||||
func _unmanagedLeaf(at path: Path) -> UnmanagedLeaf? {
|
||||
assert(path.height == self.height)
|
||||
guard path < endPath else { return nil }
|
||||
return root.unmanagedLeaf(at: path)
|
||||
}
|
||||
}
|
||||
|
||||
extension _Rope.Node {
|
||||
var asUnmanagedLeaf: UnmanagedLeaf {
|
||||
assert(height == 0)
|
||||
return UnmanagedLeaf(unsafeDowncast(self.object, to: Storage<Item>.self))
|
||||
|
||||
@@ -37,25 +37,3 @@ extension _Rope: Sequence {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension _Rope {
|
||||
func _unmanagedLeaf(at path: Path) -> UnmanagedLeaf? {
|
||||
assert(path.height == self.height)
|
||||
guard path < endPath else { return nil }
|
||||
return root.unmanagedLeaf(at: path)
|
||||
}
|
||||
|
||||
func _leaf(at path: Path) -> Node? {
|
||||
assert(path.height == self.height)
|
||||
guard _root != nil else { return nil }
|
||||
var node = root
|
||||
while true {
|
||||
let h = node.height
|
||||
let slot = path[h]
|
||||
guard slot < node.childCount else { return nil }
|
||||
if h == 0 { break }
|
||||
node = node.readInner { $0.child(at: slot)! }
|
||||
}
|
||||
return node
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user