summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/matcher/vm.lua12
-rw-r--r--server/test/definition/bug.lua6
2 files changed, 15 insertions, 3 deletions
diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua
index 413b9291..6248e550 100644
--- a/server/src/matcher/vm.lua
+++ b/server/src/matcher/vm.lua
@@ -991,11 +991,17 @@ function mt:doReturn(action)
for i, exp in ipairs(action) do
local value = self:getExp(exp)
if value.type == 'list' then
- for x, v in ipairs(value) do
+ if i == #action then
+ for x, v in ipairs(value) do
+ self:addInfo(v, 'return', exp)
+ self:setFunctionReturn(self:getCurrentFunction(), i + x - 1, v)
+ end
+ break
+ else
+ local v = value[1] or self:createValue('nil', exp)
self:addInfo(v, 'return', exp)
- self:setFunctionReturn(self:getCurrentFunction(), i + x - 1, v)
+ self:setFunctionReturn(self:getCurrentFunction(), i, v)
end
- break
else
self:addInfo(value, 'return', exp)
self:setFunctionReturn(self:getCurrentFunction(), i, value)
diff --git a/server/test/definition/bug.lua b/server/test/definition/bug.lua
index 05420b7c..b5e8dbe9 100644
--- a/server/test/definition/bug.lua
+++ b/server/test/definition/bug.lua
@@ -77,3 +77,9 @@ local t = {
<?x?>,
}
]]
+
+TEST [[
+local a
+local <!b!>
+return f(), <?b?>
+]]