diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-14 16:41:14 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-14 16:41:14 +0800 |
commit | 64a27b89294eaf8f191c740f03ab29b629cbdb0a (patch) | |
tree | d93fc5f797c4b86e6035804d8668504eee845385 /server/src/matcher/vm.lua | |
parent | 0ce83ce2771de5766ec656c0082125cb2e7b256a (diff) | |
download | lua-language-server-64a27b89294eaf8f191c740f03ab29b629cbdb0a.zip |
修正bug
Diffstat (limited to 'server/src/matcher/vm.lua')
-rw-r--r-- | server/src/matcher/vm.lua | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/server/src/matcher/vm.lua b/server/src/matcher/vm.lua index 4a23d759..d3f5da70 100644 --- a/server/src/matcher/vm.lua +++ b/server/src/matcher/vm.lua @@ -78,7 +78,7 @@ function mt:buildTable(source) return tbl end local n = 0 - for _, obj in ipairs(source) do + for index, obj in ipairs(source) do if obj.type == 'pair' then local value = self:getExp(obj[2]) local key = obj[1] @@ -102,13 +102,24 @@ function mt:buildTable(source) end end else - local value = self:getExp(obj) + local value + if obj.type == '...' then + value = { type = 'list' } + self:unpackDots(value, 1) + else + value = self:getExp(obj) + end if value.type == 'list' then - for i, v in ipairs(value) do - local field = self:createField(tbl, n + i) - self:setValue(field, v) + if index == #source then + for i, v in ipairs(value) do + local field = self:createField(tbl, n + i) + self:setValue(field, v) + end + else + n = n + 1 + local field = self:createField(tbl, n) + self:setValue(field, value[1]) end - break else n = n + 1 local field = self:createField(tbl, n) |