summaryrefslogtreecommitdiff
path: root/server/src/vm
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/vm')
-rw-r--r--server/src/vm/global.lua2
-rw-r--r--server/src/vm/library.lua2
-rw-r--r--server/src/vm/source.lua3
-rw-r--r--server/src/vm/value.lua4
-rw-r--r--server/src/vm/vm.lua27
5 files changed, 19 insertions, 19 deletions
diff --git a/server/src/vm/global.lua b/server/src/vm/global.lua
index b0f44901..8af38206 100644
--- a/server/src/vm/global.lua
+++ b/server/src/vm/global.lua
@@ -14,7 +14,7 @@ return function (lsp)
global = t._G
for k, v in pairs(t) do
global:setChild(k, v)
- global:addInfo('set child', sourceMgr.dummy(), k)
+ global:addInfo('set child', sourceMgr.dummy(), k, v)
end
end
if lsp then
diff --git a/server/src/vm/library.lua b/server/src/vm/library.lua
index 167ac726..24a17389 100644
--- a/server/src/vm/library.lua
+++ b/server/src/vm/library.lua
@@ -54,7 +54,7 @@ function buildLibValue(lib)
for fName, fLib in pairs(lib.child) do
local fValue = buildLibValue(fLib)
value:rawSet(fName, fValue)
- value:addInfo('set child', sourceMgr.dummy(), fName)
+ value:addInfo('set child', sourceMgr.dummy(), fName, fValue)
end
end
diff --git a/server/src/vm/source.lua b/server/src/vm/source.lua
index 0f167063..810db769 100644
--- a/server/src/vm/source.lua
+++ b/server/src/vm/source.lua
@@ -4,6 +4,7 @@ mt.uri = ''
local Id = 0
local List = {}
+local Watch = setmetatable({}, {__mode = 'k'})
function mt:bindLocal(loc, action)
if loc then
@@ -99,6 +100,7 @@ local function instant(source)
Id = Id + 1
source.id = Id
List[Id] = source
+ Watch[source] = Id
setmetatable(source, mt)
return true
end
@@ -115,5 +117,6 @@ end
return {
instant = instant,
list = List,
+ watch = Watch,
dummy = dummy,
}
diff --git a/server/src/vm/value.lua b/server/src/vm/value.lua
index 9b33afe1..a1ee897b 100644
--- a/server/src/vm/value.lua
+++ b/server/src/vm/value.lua
@@ -39,10 +39,6 @@ local function create (tp, source, literal)
end
local function isDeadChild(value, index)
- local child = value._child[index]
- if not child:getSource() then
- return true
- end
for srcId, info in pairs(value._info) do
local src = sourceMgr.list[srcId]
if src
diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua
index 2a81372b..48736fe4 100644
--- a/server/src/vm/vm.lua
+++ b/server/src/vm/vm.lua
@@ -46,13 +46,13 @@ function mt:buildTable(source)
if key.index then
local index = self:getIndex(obj)
key:set('parent', tbl)
- tbl:addInfo('set child', key, index)
+ tbl:addInfo('set child', key, index, value)
tbl:setChild(index, value)
else
if key.type == 'name' then
key:set('parent', tbl)
key:set('table index', true)
- tbl:addInfo('set child', key, key[1])
+ tbl:addInfo('set child', key, key[1], value)
tbl:setChild(key[1], value)
end
end
@@ -62,17 +62,18 @@ function mt:buildTable(source)
if index == #source then
value:eachValue(function (_, v)
n = n + 1
- tbl:addInfo('set child', obj, n)
+ tbl:addInfo('set child', obj, n, v)
tbl:setChild(n, v)
end)
else
n = n + 1
- tbl:addInfo('set child', obj, n)
- tbl:setChild(n, self:getFirstInMulti(value))
+ local v = self:getFirstInMulti(value)
+ tbl:addInfo('set child', obj, n, v)
+ tbl:setChild(n, v)
end
else
n = n + 1
- tbl:addInfo('set child', obj, n)
+ tbl:addInfo('set child', obj, n, value)
tbl:setChild(n, value)
end
-- 处理写了一半的 key = value,把name类的数组元素视为哈希键
@@ -387,7 +388,7 @@ function mt:setName(name, source, value)
local ENV = self:loadLocal('_ENV')
local ENVValue = ENV:getValue()
source:bindValue(value, 'set')
- ENVValue:addInfo('set child', source, name)
+ ENVValue:addInfo('set child', source, name, value)
ENVValue:setChild(name, value)
source:set('global', true)
source:set('parentValue', ENVValue)
@@ -786,12 +787,12 @@ function mt:setOne(var, value)
if key.type == 'index' then
local index = self:getIndex(key)
key[1]:set('parent', parent)
- parent:addInfo('set child', key[1], index)
+ parent:addInfo('set child', key[1], index, value)
parent:setChild(index, value)
elseif key.type == 'name' then
local index = key[1]
key:set('parent', parent)
- parent:addInfo('set child', key, index)
+ parent:addInfo('set child', key, index, value)
parent:setChild(index, value)
end
key:bindValue(value, 'set')
@@ -921,11 +922,11 @@ function mt:doFunction(action)
source:set('object', parent)
if source.type == 'index' then
local index = self:getIndex(source)
- parent:addInfo('set child', source[1], index)
+ parent:addInfo('set child', source[1], index, value)
parent:setChild(index, value)
elseif source.type == 'name' then
local index = source[1]
- parent:addInfo('set child', source, index)
+ parent:addInfo('set child', source, index, value)
parent:setChild(index, value)
end
source:bindValue(value, 'set')
@@ -948,11 +949,11 @@ function mt:doFunction(action)
self:instantSource(source)
if source.type == 'index' then
local index = self:getIndex(source)
- parent:addInfo('set child', source[1], index)
+ parent:addInfo('set child', source[1], index, value)
parent:setChild(index, value)
elseif source.type == 'name' then
local index = source[1]
- parent:addInfo('set child', source, index)
+ parent:addInfo('set child', source, index, value)
parent:setChild(index, value)
end
source:bindValue(value, 'set')