diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-01 16:55:31 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-01 16:55:31 +0800 |
commit | d8b410ed23d3e08ee12a54e5198e447255ba7a61 (patch) | |
tree | 4ec2af8d36276f5662b45f49d97e0c45cbc0b008 /server/src/vm/vm.lua | |
parent | 36404de31bff1228ce1a785883918491db814676 (diff) | |
download | lua-language-server-d8b410ed23d3e08ee12a54e5198e447255ba7a61.zip |
修正bug
Diffstat (limited to 'server/src/vm/vm.lua')
-rw-r--r-- | server/src/vm/vm.lua | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua index eeb08b76..1a892100 100644 --- a/server/src/vm/vm.lua +++ b/server/src/vm/vm.lua @@ -396,7 +396,7 @@ function mt:unpackList(list, expect) if not list then return res end - if list.type == 'list' or list.type == 'call' then + if list.type == 'list' or list.type == 'call' or list.type == 'return' then for i, exp in ipairs(list) do if exp.type == '...' then self:unpackDots(res, expect) @@ -675,15 +675,13 @@ function mt:doReturn(action) if #action == 0 then return end - local value = self:getExp(action[1]) + local values = self:unpackList(action) local func = self:getCurrentFunction() - if value.type == 'multi' then - value:eachValue(function (i, v) - func:setReturn(i, v) - end) - else - func:setReturn(1, value) - end + local n = 0 + values:eachValue(function (value) + n = n + 1 + func:setReturn(n, value) + end) end function mt:doLabel(source) |