summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-12 15:46:12 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-12 15:46:12 +0800
commit632f171ef0b7f4a6fc6d9c789430a7026335b03f (patch)
treeaa7f111d292b98663747c06a9c04e5ced4fe7a1f
parent877540a64b8a2cbf51f8b67f9f31d397957f3654 (diff)
downloadlua-language-server-632f171ef0b7f4a6fc6d9c789430a7026335b03f.zip
修正一个bug
-rw-r--r--server/src/vm/vm.lua2
-rw-r--r--server/test/references/init.lua7
2 files changed, 9 insertions, 0 deletions
diff --git a/server/src/vm/vm.lua b/server/src/vm/vm.lua
index f78f2690..ad25235c 100644
--- a/server/src/vm/vm.lua
+++ b/server/src/vm/vm.lua
@@ -54,10 +54,12 @@ function mt:buildTable(source)
key:bindValue(value, 'set')
if key.index then
local index = self:getIndex(key)
+ key:set('parent', tbl)
tbl:addInfo('set child', key, index)
tbl:setChild(index, value)
else
if key.type == 'name' then
+ key:set('parent', tbl)
key:set('table index', true)
tbl:addInfo('set child', key, key[1])
tbl:setChild(key[1], value)
diff --git a/server/test/references/init.lua b/server/test/references/init.lua
index 2699fb70..59026031 100644
--- a/server/test/references/init.lua
+++ b/server/test/references/init.lua
@@ -71,3 +71,10 @@ local a = 1
local <!a!> = 1
<?a?> = <?a?>
]]
+
+TEST [[
+local t = {
+ <?a?> = 1
+}
+print(t.<!a!>)
+]]