summaryrefslogtreecommitdiff
path: root/script/core/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-08-17 11:08:36 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-08-17 11:08:36 +0800
commitb55df9c6704750cf129f75e0408a76806a5e80bd (patch)
tree1ace8b1bd47e0f0ab692d9f7ef9ed3d3b9dfe6f7 /script/core/diagnostics
parentfcbd75d59b8d1de2b89fc1b9e699ca607f32ad78 (diff)
downloadlua-language-server-b55df9c6704750cf129f75e0408a76806a5e80bd.zip
fix
Diffstat (limited to 'script/core/diagnostics')
-rw-r--r--script/core/diagnostics/unused-function.lua20
1 files changed, 13 insertions, 7 deletions
diff --git a/script/core/diagnostics/unused-function.lua b/script/core/diagnostics/unused-function.lua
index 523bca6e..8f6ccaac 100644
--- a/script/core/diagnostics/unused-function.lua
+++ b/script/core/diagnostics/unused-function.lua
@@ -41,14 +41,20 @@ return function (uri, callback)
if isToBeClosed(parent) then
return false
end
+ await.delay()
+ if parent.type == 'setlocal' then
+ parent = parent.node
+ end
+ local refs = parent.ref
local hasGet
- local refs = vm.getRefs(source)
- for _, src in ipairs(refs) do
- if guide.isGet(src) then
- local func = guide.getParentFunction(src)
- if not checkFunction(func) then
- hasGet = true
- break
+ if refs then
+ for _, src in ipairs(refs) do
+ if guide.isGet(src) then
+ local func = guide.getParentFunction(src)
+ if not checkFunction(func) then
+ hasGet = true
+ break
+ end
end
end
end