summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfesily <fesil@foxmail.com>2023-05-22 16:06:51 +0800
committerfesily <fesil@foxmail.com>2023-05-22 16:06:51 +0800
commit570bd8f0fe1babc404db45cfdb7a318c31010364 (patch)
tree22fef35e34c6c2eecc8bd6a715056f1ead609c01
parent86916250304abc76b4b54486851f33ac12e64caf (diff)
downloadlua-language-server-570bd8f0fe1babc404db45cfdb7a318c31010364.zip
fix warnning
-rw-r--r--script/plugins/ffi/c-parser/cpp.lua3
-rw-r--r--script/plugins/ffi/c-parser/ctypes.lua1
-rw-r--r--script/plugins/ffi/searchCode.lua3
3 files changed, 6 insertions, 1 deletions
diff --git a/script/plugins/ffi/c-parser/cpp.lua b/script/plugins/ffi/c-parser/cpp.lua
index f885e724..989bca66 100644
--- a/script/plugins/ffi/c-parser/cpp.lua
+++ b/script/plugins/ffi/c-parser/cpp.lua
@@ -1,3 +1,4 @@
+---@diagnostic disable: undefined-global, assign-type-mismatch
local cpp = {}
@@ -26,7 +27,7 @@ else
]])()
end
-local function debug() end
+local function debug(...) end
--[[
local inspect = require("inspect")
local function debug(...)
diff --git a/script/plugins/ffi/c-parser/ctypes.lua b/script/plugins/ffi/c-parser/ctypes.lua
index 284fbe84..81d0ccf6 100644
--- a/script/plugins/ffi/c-parser/ctypes.lua
+++ b/script/plugins/ffi/c-parser/ctypes.lua
@@ -107,6 +107,7 @@ local convert_value = typed("TypeList, table -> CType?, string?", function (lst,
src.ids = util.expandSingle(src.ids)
-- FIXME multiple ids, e.g.: int *x, y, *z;
local ok
+---@diagnostic disable-next-line: cast-local-type
ok, name, ret_pointer, idxs = get_name(src.id or src.ids)
if not ok then
return nil, name
diff --git a/script/plugins/ffi/searchCode.lua b/script/plugins/ffi/searchCode.lua
index 9e74e7c0..86dbc680 100644
--- a/script/plugins/ffi/searchCode.lua
+++ b/script/plugins/ffi/searchCode.lua
@@ -3,6 +3,9 @@ local vm = require 'vm'
local function getLiterals(arg)
local literals = vm.getLiterals(arg)
local res = {}
+ if not literals then
+ return res
+ end
for k, v in pairs(literals) do
if type(k) == 'string' then
res[#res+1] = k