diff options
author | sumneko <sumneko@hotmail.com> | 2019-04-25 19:41:56 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-04-25 19:41:56 +0800 |
commit | 86469f78d13bee5e53c4c073ad6c0961bc42f123 (patch) | |
tree | b670d27f4b3a973fa801f7c2ac4717e08cb01753 /server | |
parent | 7b326c86ab117428e6361f6977e6c4e8aa42a9da (diff) | |
download | lua-language-server-86469f78d13bee5e53c4c073ad6c0961bc42f123.zip |
修正一个报错
Diffstat (limited to 'server')
-rw-r--r-- | server/src/vm/vm.lua | 28 | ||||
-rw-r--r-- | server/test/full/normal.lua | 6 |
2 files changed, 21 insertions, 13 deletions
diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua index b37ff153..0aae9f51 100644 --- a/server/src/vm/vm.lua +++ b/server/src/vm/vm.lua @@ -44,20 +44,22 @@ function mt:buildTable(source) local emmy = self:getEmmy() if obj.type == 'pair' then local value = self:getFirstInMulti(self:getExp(obj[2])) - local key = obj[1] - self:instantSource(obj) - self:instantSource(key) - key:bindValue(value, 'set') - value:setEmmy(emmy) - if key.type == 'index' then - local index = self:getIndex(key) - key:set('parent', tbl) - tbl:setChild(index, value, key) - else - if key.type == 'name' then + if value then + local key = obj[1] + self:instantSource(obj) + self:instantSource(key) + key:bindValue(value, 'set') + value:setEmmy(emmy) + if key.type == 'index' then + local index = self:getIndex(key) key:set('parent', tbl) - key:set('table index', true) - tbl:setChild(key[1], value, key) + tbl:setChild(index, value, key) + else + if key.type == 'name' then + key:set('parent', tbl) + key:set('table index', true) + tbl:setChild(key[1], value, key) + end end end elseif obj.type:sub(1, 4) == 'emmy' then diff --git a/server/test/full/normal.lua b/server/test/full/normal.lua index c6897067..c51a34c6 100644 --- a/server/test/full/normal.lua +++ b/server/test/full/normal.lua @@ -130,3 +130,9 @@ end TEST [[ t[...] = 1 ]] + +TEST [[ +return { + [...] = ... +} +]] |