summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script-beta/core/diagnostics/unused-function.lua5
-rw-r--r--test-beta/diagnostics/init.lua14
2 files changed, 9 insertions, 10 deletions
diff --git a/script-beta/core/diagnostics/unused-function.lua b/script-beta/core/diagnostics/unused-function.lua
index 2bf3084a..f0bca613 100644
--- a/script-beta/core/diagnostics/unused-function.lua
+++ b/script-beta/core/diagnostics/unused-function.lua
@@ -10,15 +10,14 @@ return function (uri, callback)
if not ast then
return
end
- -- 只检查局部函数与全局函数
+ -- 只检查局部函数
guide.eachSourceType(ast.ast, 'function', function (source)
local parent = source.parent
if not parent then
return
end
if parent.type ~= 'local'
- and parent.type ~= 'setlocal'
- and parent.type ~= 'setglobal' then
+ and parent.type ~= 'setlocal' then
return
end
local hasGet
diff --git a/test-beta/diagnostics/init.lua b/test-beta/diagnostics/init.lua
index e32ef275..579a132b 100644
--- a/test-beta/diagnostics/init.lua
+++ b/test-beta/diagnostics/init.lua
@@ -332,13 +332,13 @@ TEST [[
<!local function f() end!>
]]
-TEST [[
-F = <!function () end!>
-]]
-
-TEST [[
-<!function F() end!>
-]]
+--TEST [[
+--F = <!function () end!>
+--]]
+--
+--TEST [[
+--<!function F() end!>
+--]]
config.config.diagnostics.disable['unused-local'] = false
config.config.diagnostics.disable['unused-function'] = true