diff options
author | sumneko <sumneko@hotmail.com> | 2022-03-11 16:52:51 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2022-03-11 16:52:51 +0800 |
commit | 341949e632439b76485f4707155df93f9dd4b258 (patch) | |
tree | 179b653d4a7b157a6576cb9424fdb0b85e260ed3 /script/vm/node.lua | |
parent | 36976b3df2d19d6b2593a25527516218049d630a (diff) | |
download | lua-language-server-341949e632439b76485f4707155df93f9dd4b258.zip |
update
Diffstat (limited to 'script/vm/node.lua')
-rw-r--r-- | script/vm/node.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/script/vm/node.lua b/script/vm/node.lua index 3368ab05..082a5e87 100644 --- a/script/vm/node.lua +++ b/script/vm/node.lua @@ -38,10 +38,14 @@ function m.setNode(source, node) m.nodeCache[source] = m.mergeNode(me, node) end +function m.getNode(source) + return m.nodeCache[source] +end + ---@param node vm.node ---@return vm.node.union function m.addOptional(node) - if node.type ~= 'union' then + if not node or node.type ~= 'union' then node = union(node) end node = node:addOptional() @@ -49,8 +53,11 @@ function m.addOptional(node) end ---@param node vm.node ----@return vm.node.union +---@return vm.node.union? function m.removeOptional(node) + if not node then + return node + end if node.type ~= 'union' then node = union(node) end |