diff options
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/compiler.lua | 11 | ||||
-rw-r--r-- | script/vm/global.lua | 9 | ||||
-rw-r--r-- | script/vm/tracer.lua | 5 |
3 files changed, 14 insertions, 11 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index a36904f8..663d7446 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -1303,16 +1303,13 @@ local compilerSwitch = util.switch() end) : case 'setglobal' : call(function (source) + if bindDocs(source) then + return + end if source.node[1] ~= '_ENV' then return end - local key = guide.getKeyName(source) - vm.compileByParentNode(source.node, key, function (src) - if src.type == 'doc.type.field' - or src.type == 'doc.field' then - vm.setNode(source, vm.compileNode(src)) - end - end) + vm.setNode(source, vm.compileNode(source.value)) end) : case 'getglobal' : call(function (source) diff --git a/script/vm/global.lua b/script/vm/global.lua index 5f32cd87..f9090893 100644 --- a/script/vm/global.lua +++ b/script/vm/global.lua @@ -521,10 +521,15 @@ function vm.compileByGlobal(source) if global.cate == 'variable' then vm.setNode(source, global) if guide.isAssign(source) then - vm.setNode(source, vm.compileNode(source.value)) + if source.value then + vm.setNode(source, vm.compileNode(source.value)) + end return end - vm.traceNode(source) + local node = vm.traceNode(source) + if node then + vm.setNode(source, node, true) + end return end local globalBase = vm.getGlobalBase(source) diff --git a/script/vm/tracer.lua b/script/vm/tracer.lua index 025a6ae1..d4b9e5be 100644 --- a/script/vm/tracer.lua +++ b/script/vm/tracer.lua @@ -214,6 +214,7 @@ end local lookIntoChild = util.switch() : case 'getlocal' + : case 'getglobal' ---@param tracer vm.tracer ---@param action parser.object ---@param topNode vm.node @@ -466,7 +467,7 @@ local lookIntoChild = util.switch() and call.args then local getVar = call.args[1] if getVar - and tracer.assignMap[getVar] then + and tracer.getMap[getVar] then for _, ref in ipairs(action.ref) do tracer:collectCare(ref) end @@ -694,7 +695,7 @@ end ---@param source parser.object function mt:calcNode(source) if self.getMap[source] then - local lastAssign = self:getLastAssign(0, source.start) + local lastAssign = self:getLastAssign(0, source.finish) if not lastAssign then lastAssign = source.node end |