From 33bf4c53397253fa3ce643e88fcdd05faf005617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 11 Dec 2018 20:18:02 +0800 Subject: =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/matcher/vm.lua | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'server/src/matcher/vm.lua') diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua index f090d502..d84f9062 100644 --- a/server/src/matcher/vm.lua +++ b/server/src/matcher/vm.lua @@ -96,10 +96,6 @@ function mt:mergeValue(a, b, mark) end mark[a] = true mark[b] = true - for i, info in ipairs(a) do - a[i] = nil - b[#b+1] = info - end self:mergeChild(a, b, mark) for k in pairs(a) do a[k] = nil @@ -109,6 +105,20 @@ function mt:mergeValue(a, b, mark) end end +function mt:mergeField(a, b, mark) + if not mark then + mark = {} + end + for i, info in ipairs(a) do + a[i] = nil + b[#b+1] = info + end + for i, v in ipairs(b) do + a[i] = v + end + self:mergeValue(a.value, b.value, mark) +end + function mt:mergeChild(a, b, mark) if not a.child and not b.child then return @@ -122,7 +132,7 @@ function mt:mergeChild(a, b, mark) b.child = nil for k, v in pairs(other) do if child[k] then - self:mergeValue(v.value, child[k].value, mark) + self:mergeField(v, child[k], mark) else child[k] = v end @@ -146,7 +156,6 @@ function mt:setValue(var, value, source) end if source and source.start then self:addInfo(var, 'set', source) - self:addInfo(value, 'set', source) end return value end -- cgit v1.2.3