mirror of
https://github.com/neovim/neovim.git
synced 2026-11-07 13:57:25 +00:00
Enable checks for unused code, deprecated calls, return types, and annotations. Fix the warnings and replace the deprecated highlight function. Keep exceptions where old APIs are still needed or the checker gets it wrong. AI-assisted
27 lines
483 B
Lua
27 lines
483 B
Lua
-- Basic shim for LuaJIT's table.new and table.clear.
|
|
local has_new, new = pcall(require, 'table.new')
|
|
local has_clear, clear = pcall(require, 'table.clear')
|
|
|
|
local M = {}
|
|
|
|
if not has_new then
|
|
new = function(_narr, _nrec)
|
|
return {}
|
|
end
|
|
end
|
|
|
|
if not has_clear then
|
|
clear = function(tab)
|
|
for k in pairs(tab) do
|
|
tab[k] = nil
|
|
end
|
|
end
|
|
end
|
|
|
|
---@cast new fun(narr: integer, nrec: integer): table
|
|
---@cast clear fun(tab: table)
|
|
M.new = new
|
|
M.clear = clear
|
|
|
|
return M
|