From 43e35b1a991f88407a4b560ee5f12138d83056b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 15 Mar 2019 16:30:58 +0800 Subject: =?UTF-8?q?=E9=9D=9E=E5=85=A8=E5=B1=80=E5=8F=98=E9=87=8F=E4=B9=9F?= =?UTF-8?q?=E8=A6=81=E5=88=A4=E6=96=AD=E6=AD=BB=E6=8E=89=E7=9A=84child?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/vm/global.lua | 1 - server/src/vm/value.lua | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'server/src') 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 -- cgit v1.2.3