Skip to content

Commit 8ce3ec6

Browse files
committed
eliminate expensive calls to childstatetype in StableCursor
1 parent 7af95ba commit 8ce3ec6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cursors.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,10 @@ struct StableCursor{N,S} <: TreeCursor{N,N}
271271

272272
# note that this very deliberately takes childstatetype(n) and *not* childstatetype(p)
273273
# this is because p may be nothing
274-
StableCursor(p, n, st) = new{typeof(n),childstatetype(n)}(p, n, st)
274+
StableCursor(::Nothing, n, st) = new{typeof(n),childstatetype(n)}(nothing, n, st)
275+
276+
# this method is important for eliminating expensive calls to childstatetype
277+
StableCursor(p::StableCursor{N,S}, n, st) where {N,S} = new{N,S}(p, n, st)
275278
end
276279

277280
StableCursor(node) = StableCursor(nothing, node, nothing)

0 commit comments

Comments
 (0)