summaryrefslogtreecommitdiff
path: root/server/src/core/global.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-23 16:43:23 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-23 16:43:23 +0800
commitc6f18e40500e5c1ffd5c27bc589d413804632cb3 (patch)
tree68d0d5137f47e6640e3290e92ddfffbf0a381b27 /server/src/core/global.lua
parentcbcb02406fc0f317af5bd575515e9881e4bd5a25 (diff)
downloadlua-language-server-c6f18e40500e5c1ffd5c27bc589d413804632cb3.zip
支持全局变量的子项
Diffstat (limited to 'server/src/core/global.lua')
-rw-r--r--server/src/core/global.lua21
1 files changed, 7 insertions, 14 deletions
diff --git a/server/src/core/global.lua b/server/src/core/global.lua
index ba4fdc47..9dca50d0 100644
--- a/server/src/core/global.lua
+++ b/server/src/core/global.lua
@@ -26,26 +26,19 @@ end
function mt:compileVM(uri, vm)
local seted = {}
- for k, v in next, vm.env.child do
- local get, set
- for _, info in ipairs(v) do
- if info.type == 'get' then
- get = true
- elseif info.type == 'set' then
- set = true
- end
- end
- if set then
- self:markSet(uri, k, v)
- seted[#seted+1] = k
- elseif get then
+ for k, v in pairs(vm.results.globals) do
+ seted[k] = true
+ self:markSet(uri, k, v)
+ end
+ for k in next, vm.env.child do
+ if not seted[k] then
self:markGet(uri, k)
end
end
local needReCompile = {}
for otherUri, gets in pairs(self.get) do
- for _, key in ipairs(seted) do
+ for key in pairs(seted) do
if gets[key] ~= nil then
needReCompile[#needReCompile+1] = otherUri
goto CONTINUE