diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-28 20:06:34 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-28 20:06:34 +0800 |
commit | 5b950742705515c4bc2502e8a902221f44bf644f (patch) | |
tree | f57ba3f1159eecfba3d882703b1b5775e0e72541 /script/core/diagnostics/unused-function.lua | |
parent | deac4582d38908c1281d4d5215b7b69ff8400dca (diff) | |
download | lua-language-server-5b950742705515c4bc2502e8a902221f44bf644f.zip |
cleanup
Diffstat (limited to 'script/core/diagnostics/unused-function.lua')
-rw-r--r-- | script/core/diagnostics/unused-function.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/script/core/diagnostics/unused-function.lua b/script/core/diagnostics/unused-function.lua index 813ac804..a873375f 100644 --- a/script/core/diagnostics/unused-function.lua +++ b/script/core/diagnostics/unused-function.lua @@ -18,7 +18,8 @@ local function isToBeClosed(source) return false end ----@param source parser.object +---@param source parser.object? +---@return boolean local function isValidFunction(source) if not source then return false @@ -55,7 +56,7 @@ local function collect(ast, white, roots, links) for _, ref in ipairs(loc.ref or {}) do if ref.type == 'getlocal' then local func = guide.getParentFunction(ref) - if not isValidFunction(func) or roots[func] then + if not func or not isValidFunction(func) or roots[func] then roots[src] = true return end |