summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/core/diagnostics/unused-local.lua19
1 files changed, 17 insertions, 2 deletions
diff --git a/script/core/diagnostics/unused-local.lua b/script/core/diagnostics/unused-local.lua
index 873a70f2..57730c5f 100644
--- a/script/core/diagnostics/unused-local.lua
+++ b/script/core/diagnostics/unused-local.lua
@@ -38,7 +38,7 @@ local function isMyTable(loc)
return false
end
-local function isClose(source)
+local function isToBeClosed(source)
if not source.attrs then
return false
end
@@ -50,6 +50,18 @@ local function isClose(source)
return false
end
+local function isDocClass(source)
+ if not source.bindDocs then
+ return false
+ end
+ for _, doc in ipairs(source.bindDocs) do
+ if doc.type == 'doc.class' then
+ return true
+ end
+ end
+ return false
+end
+
return function (uri, callback)
local ast = files.getAst(uri)
if not ast then
@@ -61,7 +73,10 @@ return function (uri, callback)
or name == ast.ENVMode then
return
end
- if isClose(source) then
+ if isToBeClosed(source) then
+ return
+ end
+ if isDocClass(source) then
return
end
local data = hasGet(source)