From 35772e7b833f352a7a36a95b2f6a0486f8738fc3 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, 25 Jan 2019 11:29:35 +0800 Subject: =?UTF-8?q?=E4=B8=8D=E5=86=8D=E6=9A=B4=E5=8A=9B=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E6=88=96=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/value.lua | 3 ++- server/src/core/vm.lua | 22 ++++++---------------- 2 files changed, 8 insertions(+), 17 deletions(-) (limited to 'server/src') diff --git a/server/src/core/value.lua b/server/src/core/value.lua index a8b054b5..632f6cd4 100644 --- a/server/src/core/value.lua +++ b/server/src/core/value.lua @@ -100,7 +100,7 @@ function mt:eachField(callback) end end -function mt:addInfo(tp, source) +function mt:addInfo(tp, source, var) if source and not source.start then error('Miss start: ' .. table.dump(source)) end @@ -114,6 +114,7 @@ function mt:addInfo(tp, source) self._info[uri][#self._info[uri]+1] = { type = tp, source = source or DefaultSource, + var = var, } return self end diff --git a/server/src/core/vm.lua b/server/src/core/vm.lua index 6f3a9991..61314add 100644 --- a/server/src/core/vm.lua +++ b/server/src/core/vm.lua @@ -144,13 +144,14 @@ function mt:scopePop() self.scope:pop() end -function mt:addInfo(obj, type, source) +function mt:addInfo(obj, type, source, value) if source and not source.start then error('Miss start: ' .. table.dump(source)) end obj[#obj+1] = { type = type, source = source or DefaultSource, + value = value, } if source then source.uri = self.uri @@ -331,23 +332,12 @@ function mt:setValue(var, value, source) if value and value.type == 'list' then error('Cant set value list') end - value = value or self:createValue('any', source) + value = value or self:createValue('nil', source) if source and source.start then - self:addInfo(var, 'set', source) - value:addInfo('set', source) - end - if var.value then - if value:getType() == 'any' then - self:mergeChild(var.value, value) - elseif value:getType() == 'nil' then - self:mergeValue(var.value, value) - elseif var.value.uri == self.uri then - var.value = value - end - value = var.value - else - var.value = value + self:addInfo(var, 'set', source, value) + value:addInfo('set', source, var) end + var.value = value return value end -- cgit v1.2.3