summaryrefslogtreecommitdiff
path: root/server/src/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-15 16:30:58 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-15 16:30:58 +0800
commit43e35b1a991f88407a4b560ee5f12138d83056b5 (patch)
tree8b73f729b8537d1822edb5872103c66f26520dcd /server/src/vm
parent5822e5ad4b7ae4d0bd1867323527bb419ed09d37 (diff)
downloadlua-language-server-43e35b1a991f88407a4b560ee5f12138d83056b5.zip
非全局变量也要判断死掉的child
Diffstat (limited to 'server/src/vm')
-rw-r--r--server/src/vm/global.lua1
-rw-r--r--server/src/vm/value.lua12
2 files changed, 5 insertions, 8 deletions
diff --git a/server/src/vm/global.lua b/server/src/vm/global.lua
index 58893d66..b0f44901 100644
--- a/server/src/vm/global.lua
+++ b/server/src/vm/global.lua
@@ -12,7 +12,6 @@ return function (lsp)
end
global = t._G
- global:set('_G', true)
for k, v in pairs(t) do
global:setChild(k, v)
global:addInfo('set child', sourceMgr.dummy(), k)
diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua
index a2e6ba05..4fa4b53b 100644
--- a/server/src/vm/value.lua
+++ b/server/src/vm/value.lua
@@ -38,7 +38,7 @@ local function create (tp, source, literal)
return self
end
-local function isDeadGlobalChild(value, index)
+local function isDeadChild(value, index)
for srcId, info in pairs(value._info) do
local src = sourceMgr.list[srcId]
if src
@@ -105,11 +105,9 @@ function mt:rawGet(index)
if not child then
return nil
end
- if self:get '_G' then
- if isDeadGlobalChild(self, index) then
- self._child[index] = nil
- return nil
- end
+ if isDeadChild(self, index) then
+ self._child[index] = nil
+ return nil
end
return child
end
@@ -202,7 +200,7 @@ function mt:rawEach(callback, foundIndex)
end
foundIndex[index] = true
end
- if self:get '_G' and isDeadGlobalChild(self, index) then
+ if isDeadChild(self, index) then
self._child[index] = nil
goto CONTINUE
end