summaryrefslogtreecommitdiff
path: root/script/vm/node.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-22 16:54:29 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-22 16:54:29 +0800
commit72effeb8f9d9f3c04d4f5aa4f228dcd1d84f2815 (patch)
tree7dd84148241e2d68930250fc8c294ffa80506134 /script/vm/node.lua
parent09512074acae34fccc60f31a8c84d022e03ddf23 (diff)
downloadlua-language-server-72effeb8f9d9f3c04d4f5aa4f228dcd1d84f2815.zip
update
Diffstat (limited to 'script/vm/node.lua')
-rw-r--r--script/vm/node.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/script/vm/node.lua b/script/vm/node.lua
index 61781e5f..8ed5c027 100644
--- a/script/vm/node.lua
+++ b/script/vm/node.lua
@@ -310,6 +310,7 @@ end
---@param source vm.object
---@param node vm.node | vm.object
---@param cover? boolean
+---@return vm.node
function vm.setNode(source, node, cover)
if not node then
if TEST then
@@ -324,18 +325,20 @@ function vm.setNode(source, node, cover)
if cover then
---@cast node vm.node
vm.nodeCache[source] = node
- return
+ return node
end
local me = vm.nodeCache[source]
if me then
me:merge(node)
else
if node.type == 'vm.node' then
- vm.nodeCache[source] = node:copy()
+ me = node:copy()
else
- vm.nodeCache[source] = vm.createNode(node)
+ me = vm.createNode(node)
end
+ vm.nodeCache[source] = me
end
+ return me
end
---@param source vm.object