Skip to content

Commit

Permalink
Fix a bug that made TreeCursor.iterate iterate through sibling nodes
Browse files Browse the repository at this point in the history
FIX: Fix an issue in `TreeCursor.iterate` that made it iterate through siblings of the
current node.

Closes lezer-parser/lezer#60
  • Loading branch information
not-my-profile authored and marijnh committed Oct 16, 2024
1 parent d1207ef commit ae3e347
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1318,8 +1318,8 @@ export class TreeCursor implements SyntaxNodeRef {
for (;;) {
if (mustLeave && leave) leave(this)
mustLeave = this.type.isAnonymous
if (this.nextSibling()) break
if (!depth) return
if (this.nextSibling()) break
this.parent()
depth--
mustLeave = true
Expand Down

0 comments on commit ae3e347

Please sign in to comment.