From 53addf4379d9fc9d5ff23a8888022c4dcc6883f5 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:51:16 +0800 Subject: =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=B8=80=E4=B8=AAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/vm/value.lua | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'server/src/vm/value.lua') diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua index 4fa4b53b..a1ee897b 100644 --- a/server/src/vm/value.lua +++ b/server/src/vm/value.lua @@ -138,17 +138,7 @@ function mt:eachLibChild(callback) end end -function mt:getChild(index, source) - local value = self:_getChild(index) - if not value then - value = create('any', source) - self:setChild(index, value) - value.uri = self.uri - end - return value -end - -function mt:_getChild(index, source, mark) +local function finishGetChild(self, index, source, mark) self:setType('table', 0.5) local value = self:rawGet(index) if value then @@ -166,7 +156,18 @@ function mt:_getChild(index, source, mark) return nil end mark[method] = true - return method:_getChild(index, source, mark) + + return finishGetChild(method, index, source, mark) +end + +function mt:getChild(index, source) + local value = finishGetChild(self, index) + if not value then + value = create('any', source) + self:setChild(index, value) + value.uri = self.uri + end + return value end function mt:bindChild(other) -- cgit v1.2.3