summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-21 17:31:51 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-21 17:31:51 +0800
commitfdbc2738d8a79aaf76ba2177b9144295886e39b8 (patch)
treeaea8dd596a348ce168e52a5247d7d48965bf58e1 /server/src
parent1376bba0f9cfc3e8f06130c3bb4f86589b0dc32a (diff)
downloadlua-language-server-fdbc2738d8a79aaf76ba2177b9144295886e39b8.zip
修正多返回值遇到函数调用的bug
Diffstat (limited to 'server/src')
-rw-r--r--server/src/matcher/vm.lua12
1 files changed, 9 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)