summaryrefslogtreecommitdiff
path: root/server-beta/src/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-10 19:40:54 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-10 19:40:54 +0800
commit5668f4ded84192efd4ebd9cd82e9619398f9bebe (patch)
treed12f63dc3875a57479760b912674edb9ad6e67ac /server-beta/src/core
parent0d1a38eb45e67c5e724cba354ca673344d69b4e9 (diff)
downloadlua-language-server-5668f4ded84192efd4ebd9cd82e9619398f9bebe.zip
统一判断方式
Diffstat (limited to 'server-beta/src/core')
-rw-r--r--server-beta/src/core/diagnostics/undefined-global.lua15
1 files changed, 8 insertions, 7 deletions
diff --git a/server-beta/src/core/diagnostics/undefined-global.lua b/server-beta/src/core/diagnostics/undefined-global.lua
index b3ef3044..1a0af9d9 100644
--- a/server-beta/src/core/diagnostics/undefined-global.lua
+++ b/server-beta/src/core/diagnostics/undefined-global.lua
@@ -11,20 +11,20 @@ return function (uri, callback)
end
-- 遍历全局变量,检查所有没有 mode['set'] 的全局变量
- searcher.eachGlobal(ast.ast, function (infos)
+ local globals = searcher.getGlobals(ast.ast)
+ for key, infos in pairs(globals) do
if infos.mode['set'] == true then
- return
+ goto CONTINUE
end
- local key = infos.key
local skey = key and key:match '^s|(.+)$'
if not skey then
- return
+ goto CONTINUE
end
if library.global[skey] then
- return
+ goto CONTINUE
end
if config.config.diagnostics.globals[skey] then
- return
+ goto CONTINUE
end
local message
local otherVersion = library.other[skey]
@@ -43,5 +43,6 @@ return function (uri, callback)
message = message,
}
end
- end)
+ ::CONTINUE::
+ end
end