summaryrefslogtreecommitdiff
path: root/script/vm/infer.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-01-30 12:38:03 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-01-30 12:38:03 +0800
commit02f6831344efd3a32c0ac8a1fbd0d00af3dec671 (patch)
treecee8015a49eebd4da3238ff7c010beea516f3066 /script/vm/infer.lua
parentf5d631b87b38a54b8cb40dec602a7f1910fe7e4f (diff)
downloadlua-language-server-02f6831344efd3a32c0ac8a1fbd0d00af3dec671.zip
fix wrong infer of tableindex
#1831
Diffstat (limited to 'script/vm/infer.lua')
-rw-r--r--script/vm/infer.lua13
1 files changed, 4 insertions, 9 deletions
diff --git a/script/vm/infer.lua b/script/vm/infer.lua
index 74cab4ed..0b20700c 100644
--- a/script/vm/infer.lua
+++ b/script/vm/infer.lua
@@ -555,19 +555,14 @@ function vm.viewKey(source, uri)
return '[' .. key .. ']'
end
end
- if source.type == 'tableindex' then
+ if source.type == 'tableindex'
+ or source.type == 'setindex' then
local index = source.index
- local name = vm.getKeyName(index)
+ local name = vm.getInfer(index):viewLiterals()
if not name then
return nil
end
- local key
- if index.type == 'string' then
- key = util.viewString(name, index[2])
- else
- key = util.viewLiteral(name)
- end
- return ('[%s]'):format(key), name
+ return ('[%s]'):format(name), name
end
if source.type == 'tableexp' then
return ('[%d]'):format(source.tindex), source.tindex