summaryrefslogtreecommitdiff
path: root/script/core/diagnostics/undefined-global.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-05-19 14:41:18 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-05-19 14:41:18 +0800
commitb2e8f04b3509caf5df2f41fa0858ef92df3700fc (patch)
tree219f5d3223cd18e8ce11aa45f7539f4eebe07075 /script/core/diagnostics/undefined-global.lua
parent81a3ad79e4f057d5670689e27823acf8391ce621 (diff)
downloadlua-language-server-b2e8f04b3509caf5df2f41fa0858ef92df3700fc.zip
update
Diffstat (limited to 'script/core/diagnostics/undefined-global.lua')
-rw-r--r--script/core/diagnostics/undefined-global.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/script/core/diagnostics/undefined-global.lua b/script/core/diagnostics/undefined-global.lua
index 3c7f02d1..439a1854 100644
--- a/script/core/diagnostics/undefined-global.lua
+++ b/script/core/diagnostics/undefined-global.lua
@@ -1,9 +1,9 @@
-local files = require 'files'
-local vm = require 'vm'
-local lang = require 'language'
-local config = require 'config'
-local searcher = require 'core.searcher'
-local define = require 'proto.define'
+local files = require 'files'
+local vm = require 'vm'
+local lang = require 'language'
+local config = require 'config'
+local guide = require 'parser.guide'
+local linker = require 'core.linker'
local requireLike = {
['include'] = true,
@@ -19,8 +19,8 @@ return function (uri, callback)
end
-- 遍历全局变量,检查所有没有 set 模式的全局变量
- searcher.eachSourceType(ast.ast, 'getglobal', function (src)
- local key = searcher.getKeyName(src)
+ guide.eachSourceType(ast.ast, 'getglobal', function (src)
+ local key = src[1]
if not key then
return
end
@@ -30,7 +30,7 @@ return function (uri, callback)
if config.config.runtime.special[key] then
return
end
- if #vm.getGlobalSets(key) == 0 then
+ if #vm.getDefs(src) == 0 then
local message = lang.script('DIAG_UNDEF_GLOBAL', key)
if requireLike[key:lower()] then
message = ('%s(%s)'):format(message, lang.script('DIAG_REQUIRE_LIKE', key))