summaryrefslogtreecommitdiff
path: root/script/vm/node.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-06-27 00:06:48 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-06-27 00:06:48 +0800
commitc50a20ddad4adb3e0f8ead37a2e6a9960fe3000d (patch)
treebbb1a4f02ae6e2f659dfc48c7339d7bb01de18b1 /script/vm/node.lua
parent031dc060e3cf2096e9171e168f15346e7d481f41 (diff)
downloadlua-language-server-c50a20ddad4adb3e0f8ead37a2e6a9960fe3000d.zip
fix #1235 don't drop node in `for`/`while`...
Diffstat (limited to 'script/vm/node.lua')
-rw-r--r--script/vm/node.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/script/vm/node.lua b/script/vm/node.lua
index 2128edb2..16b5a8d8 100644
--- a/script/vm/node.lua
+++ b/script/vm/node.lua
@@ -20,13 +20,14 @@ mt.optional = nil
mt.data = nil
---@param node vm.node | vm.node.object
+---@return vm.node
function mt:merge(node)
if not node then
- return
+ return self
end
if node.type == 'vm.node' then
if node == self then
- return
+ return self
end
if node:isOptional() then
self.optional = true
@@ -44,6 +45,7 @@ function mt:merge(node)
self[#self+1] = node
end
end
+ return self
end
---@return boolean