diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2020-02-25 13:03:40 +0100 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2020-02-25 22:20:23 +0100 |
commit | 3ce9b05653a71efe2eeaeca6b6132d1227c367b7 (patch) | |
tree | c18b41e10c87af838fddda94eb4e8f65ca671586 /src/tree_sitter/subtree.c | |
parent | 96059d72e539c0a23c1f7a24290f35247ff01749 (diff) | |
download | rneovim-3ce9b05653a71efe2eeaeca6b6132d1227c367b7.tar.gz rneovim-3ce9b05653a71efe2eeaeca6b6132d1227c367b7.tar.bz2 rneovim-3ce9b05653a71efe2eeaeca6b6132d1227c367b7.zip |
treesitter: update vendored tree-sitter runtime
tree-sitter/tree-sitter commit 6cb8d24de2d99c4c50c9a0fd1e719ca5b3abc87f
Included files are:
lib/include/tree-sitter/*.h
lib/src/*.[ch]
lib/src/unicode/*
LICENSE
Diffstat (limited to 'src/tree_sitter/subtree.c')
-rw-r--r-- | src/tree_sitter/subtree.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/tree_sitter/subtree.c b/src/tree_sitter/subtree.c index 30144fa175..b98f172339 100644 --- a/src/tree_sitter/subtree.c +++ b/src/tree_sitter/subtree.c @@ -322,12 +322,9 @@ void ts_subtree_balance(Subtree self, SubtreePool *pool, const TSLanguage *langu if (tree.ptr->repeat_depth > 0) { Subtree child1 = tree.ptr->children[0]; Subtree child2 = tree.ptr->children[tree.ptr->child_count - 1]; - if ( - ts_subtree_child_count(child1) > 0 && - ts_subtree_child_count(child2) > 0 && - child1.ptr->repeat_depth > child2.ptr->repeat_depth - ) { - unsigned n = child1.ptr->repeat_depth - child2.ptr->repeat_depth; + long repeat_delta = (long)ts_subtree_repeat_depth(child1) - (long)ts_subtree_repeat_depth(child2); + if (repeat_delta > 0) { + unsigned n = repeat_delta; for (unsigned i = n / 2; i > 0; i /= 2) { ts_subtree__compress(tree, i, language, &pool->tree_stack); n -= i; @@ -344,10 +341,6 @@ void ts_subtree_balance(Subtree self, SubtreePool *pool, const TSLanguage *langu } } -static inline uint32_t ts_subtree_repeat_depth(Subtree self) { - return ts_subtree_child_count(self) ? self.ptr->repeat_depth : 0; -} - void ts_subtree_set_children( MutableSubtree self, Subtree *children, uint32_t child_count, const TSLanguage *language ) { |