summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2023-08-18 09:19:59 +0300
committerEli Zaretskii <eliz@gnu.org>2023-08-18 09:19:59 +0300
commitf6ebd1ef0d028fb5d4551e6766ee882538db132a (patch)
tree98fc383496ffab208b05fa593cd265ea3d81e482
parentfac0e2d533427ba7afc2c11427f46acc57fa6be8 (diff)
downloademacs-f6ebd1ef0d028fb5d4551e6766ee882538db132a.tar.gz
; * src/treesit.c (Ftreesit_node_parent): Improve commentary.
-rw-r--r--src/treesit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/treesit.c b/src/treesit.c
index 705ef6af39f..e359f903f28 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -1886,6 +1886,10 @@ Return nil if NODE has no parent. If NODE is nil, return nil. */)
TSNode treesit_node = XTS_NODE (node)->node;
Lisp_Object parser = XTS_NODE (node)->parser;
TSTreeCursor cursor;
+ /* See the comments to treesit_cursor_helper about the algorithm for
+ finding the parent node. The complexity is roughly proportional
+ to the square root of the current node's depth in the parse tree,
+ and we punt if the tree is too deep. */
if (!treesit_cursor_helper (&cursor, treesit_node, parser))
return return_value;