diff options
Diffstat (limited to 'script/vm/node/union.lua')
-rw-r--r-- | script/vm/node/union.lua | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/script/vm/node/union.lua b/script/vm/node/union.lua index 928a9216..a8c917d9 100644 --- a/script/vm/node/union.lua +++ b/script/vm/node/union.lua @@ -5,9 +5,8 @@ local mt = {} mt.__index = mt mt.type = 'union' ----@param source parser.object ---@param node vm.node -function mt:merge(source, node) +function mt:merge(node) if not node then return end @@ -30,13 +29,21 @@ function mt:subscribeLiteral(source) end end ----@param source parser.object +function mt:eachNode() + local i = 0 + return function () + i = i + 1 + return self[i] + end +end + +---@param me parser.object ---@param node vm.node ---@return vm.node.union -return function (source, node) +return function (me, node) local union = setmetatable({ - source, + [1] = me, }, mt) - union:merge(source, node) + union:merge(node) return union end |