aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter/query.lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim/treesitter/query.lua')
-rw-r--r--runtime/lua/vim/treesitter/query.lua13
1 files changed, 2 insertions, 11 deletions
diff --git a/runtime/lua/vim/treesitter/query.lua b/runtime/lua/vim/treesitter/query.lua
index 36c78b7f1d..ef5c2143a7 100644
--- a/runtime/lua/vim/treesitter/query.lua
+++ b/runtime/lua/vim/treesitter/query.lua
@@ -457,17 +457,8 @@ local predicate_handlers = {
end
for _, node in ipairs(nodes) do
- local ancestor_types = {} --- @type table<string, boolean>
- for _, type in ipairs({ unpack(predicate, 3) }) do
- ancestor_types[type] = true
- end
-
- local cur = node:parent()
- while cur do
- if ancestor_types[cur:type()] then
- return true
- end
- cur = cur:parent()
+ if node:__has_ancestor(predicate) then
+ return true
end
end
return false