diff options
Diffstat (limited to 'script/vm/runner.lua')
-rw-r--r-- | script/vm/runner.lua | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/script/vm/runner.lua b/script/vm/runner.lua index 5d561677..05dcbb7a 100644 --- a/script/vm/runner.lua +++ b/script/vm/runner.lua @@ -8,6 +8,7 @@ local guide = require 'parser.guide' ---@field _loc parser.object ---@field _objs parser.object[] ---@field _callback vm.runner.callback +---@field _mark table local mt = {} mt.__index = mt mt._index = 1 @@ -117,6 +118,17 @@ function mt:_lookInto(action, topNode, outNode) if not action then return topNode, outNode end + if self._mark[action] then + return + end + self._mark[action] = true + local top = self._objs[self._index] + if not top then + return topNode, outNode + end + if not guide.isInRange(action, top.finish) then + return topNode, outNode + end local set local value = vm.getObjectValue(action) if value then @@ -232,10 +244,10 @@ function mt:_lookInto(action, topNode, outNode) self:_lookInto(arg, topNode) end end - elseif action.type == 'return' then - for _, rtn in ipairs(action) do - self:_lookInto(rtn, topNode) - end + else + guide.eachSourceContain(action, top.finish, function(source) + self:_lookInto(source, topNode) + end) end ::RETURN:: topNode = self:_fastWard(action.finish, topNode) @@ -275,6 +287,7 @@ function vm.launchRunner(loc, callback) local self = setmetatable({ _loc = loc, _objs = {}, + _mark = {}, _callback = callback, }, mt) |