Skip to content

Commit 24c8936

Browse files
committed
Another perf tweak
1 parent 0f09e28 commit 24c8936

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/green_node.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,13 @@ function build_tree(T::Type{GreenNode}, stream::ParseStream; kws...)
137137
# to test a partial parse. Wrap everything in K"wrapper"
138138
all_processed = 0
139139
local cs
140-
while true
141-
c = GreenNode(cursor)
140+
for child in reverse_toplevel_siblings(cursor)
141+
c = GreenNode(child)
142142
if !@isdefined(cs)
143-
cs = [c]
143+
cs = GreenNode{SyntaxHead}[c]
144144
else
145145
pushfirst!(cs, c)
146146
end
147-
all_processed += treesize(cursor)+1
148-
all_processed == length(stream.output)-1 && break
149-
cursor = GreenTreeCursor(stream.output, length(stream.output) - all_processed)
150147
end
151148
@assert length(cs) != 1
152149
return GreenNode(SyntaxHead(K"wrapper", NON_TERMINAL_FLAG), stream.next_byte-1, cs)

0 commit comments

Comments
 (0)