mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
refactor(treesitter): simplify some range functions
This commit is contained in:
@@ -53,6 +53,26 @@ M.cmp_pos = {
|
||||
|
||||
setmetatable(M.cmp_pos, { __call = cmp_pos })
|
||||
|
||||
---@private
|
||||
---Check if a variable is a valid range object
|
||||
---@param r any
|
||||
---@return boolean
|
||||
function M.validate(r)
|
||||
if type(r) ~= 'table' or #r ~= 6 and #r ~= 4 then
|
||||
return false
|
||||
end
|
||||
|
||||
for _, e in
|
||||
ipairs(r --[[@as any[] ]])
|
||||
do
|
||||
if type(e) ~= 'number' then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
---@private
|
||||
---@param r1 Range4|Range6
|
||||
---@param r2 Range4|Range6
|
||||
|
||||
Reference in New Issue
Block a user