summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-10 21:18:25 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-10 21:18:25 +0800
commit80f8f5bdda5a0401f28a83ea9dd649309ad16c55 (patch)
treee86329cee82516ad900fe3d6845e929761b48c29
parent28f7ece61d1040b374de6be4adc6c8c65c24805f (diff)
downloadlua-language-server-80f8f5bdda5a0401f28a83ea9dd649309ad16c55.zip
修正报错
-rw-r--r--server-beta/src/core/diagnostics/unused-function.lua5
-rw-r--r--server-beta/src/searcher/getGlobals.lua3
2 files changed, 5 insertions, 3 deletions
diff --git a/server-beta/src/core/diagnostics/unused-function.lua b/server-beta/src/core/diagnostics/unused-function.lua
index 0886660d..0dd55906 100644
--- a/server-beta/src/core/diagnostics/unused-function.lua
+++ b/server-beta/src/core/diagnostics/unused-function.lua
@@ -10,11 +10,10 @@ return function (uri, callback)
return
end
guide.eachSourceType(ast.ast, 'function', function (source)
- local hasGet
local hasSet
- searcher.eachRef(source, function (info)
+ local hasGet = searcher.eachRef(source, function (info)
if info.mode == 'get' then
- hasGet = true
+ return true
elseif info.mode == 'set'
or info.mode == 'declare' then
hasSet = true
diff --git a/server-beta/src/searcher/getGlobals.lua b/server-beta/src/searcher/getGlobals.lua
index 56c489bd..4519985b 100644
--- a/server-beta/src/searcher/getGlobals.lua
+++ b/server-beta/src/searcher/getGlobals.lua
@@ -13,6 +13,9 @@ local function getGlobals(source)
end
mark[src] = true
local name = info.key
+ if not name then
+ return
+ end
if not cache[name] then
cache[name] = {
key = name,