diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-01-30 12:38:03 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-01-30 12:38:03 +0800 |
commit | 02f6831344efd3a32c0ac8a1fbd0d00af3dec671 (patch) | |
tree | cee8015a49eebd4da3238ff7c010beea516f3066 /script/vm/infer.lua | |
parent | f5d631b87b38a54b8cb40dec602a7f1910fe7e4f (diff) | |
download | lua-language-server-02f6831344efd3a32c0ac8a1fbd0d00af3dec671.zip |
fix wrong infer of tableindex
#1831
Diffstat (limited to 'script/vm/infer.lua')
-rw-r--r-- | script/vm/infer.lua | 13 |
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 |