summaryrefslogtreecommitdiff
path: root/server-beta/src/core/diagnostics
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-10 17:58:48 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-10 17:58:48 +0800
commitfe53e824366b7f035b22d3dfac1c886f01e7044c (patch)
tree7f8622e0df0387885c6e61755a6f7ceb2f288ae3 /server-beta/src/core/diagnostics
parent96955fce58180eb5bf86d11747f7712bbefbcf62 (diff)
downloadlua-language-server-fe53e824366b7f035b22d3dfac1c886f01e7044c.zip
优化全局变量性能
Diffstat (limited to 'server-beta/src/core/diagnostics')
-rw-r--r--server-beta/src/core/diagnostics/undefined-env-child.lua5
-rw-r--r--server-beta/src/core/diagnostics/undefined-global.lua5
2 files changed, 4 insertions, 6 deletions
diff --git a/server-beta/src/core/diagnostics/undefined-env-child.lua b/server-beta/src/core/diagnostics/undefined-env-child.lua
index 5815f9c3..4169a413 100644
--- a/server-beta/src/core/diagnostics/undefined-env-child.lua
+++ b/server-beta/src/core/diagnostics/undefined-env-child.lua
@@ -14,10 +14,9 @@ return function (uri, callback)
if source.node.tag == '_ENV' then
return
end
- local setInENV
- searcher.eachRef(source, function (info)
+ local setInENV = searcher.eachRef(source, function (info)
if info.mode == 'set' then
- setInENV = true
+ return true
end
end)
if setInENV then
diff --git a/server-beta/src/core/diagnostics/undefined-global.lua b/server-beta/src/core/diagnostics/undefined-global.lua
index 586a9955..b39803b8 100644
--- a/server-beta/src/core/diagnostics/undefined-global.lua
+++ b/server-beta/src/core/diagnostics/undefined-global.lua
@@ -18,10 +18,9 @@ return function (uri, callback)
if hasSet[info.source] ~= nil then
return
end
- local mark = false
- searcher.eachRef(info.source, function (info)
+ local mark = searcher.eachRef(info.source, function (info)
if info.mode == 'set' then
- mark = true
+ return true
end
end)
searcher.eachRef(info.source, function (info)