From ae3e3473f74acdcf579e652da2a4bc0b7855c33f Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Thu, 3 Oct 2024 06:31:08 +0200 Subject: [PATCH] Fix a bug that made TreeCursor.iterate iterate through sibling nodes FIX: Fix an issue in `TreeCursor.iterate` that made it iterate through siblings of the current node. Closes https://github.com/lezer-parser/lezer/issues/60 --- src/tree.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tree.ts b/src/tree.ts index 5ff0958..e31f6a0 100644 --- a/src/tree.ts +++ b/src/tree.ts @@ -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