diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-01-30 14:38:08 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-01-30 14:38:08 +0800 |
commit | c69e65f5468a3aff99f1de11ee7c72a0d9f75afe (patch) | |
tree | 225053bed8d7c4c6af6314c2f88de85cad544055 /script/vm/compiler.lua | |
parent | 02f6831344efd3a32c0ac8a1fbd0d00af3dec671 (diff) | |
download | lua-language-server-c69e65f5468a3aff99f1de11ee7c72a0d9f75afe.zip |
infer types of tableindex by semantic
fix #1831
Diffstat (limited to 'script/vm/compiler.lua')
-rw-r--r-- | script/vm/compiler.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index a3057629..a438d06f 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -1325,6 +1325,18 @@ local compilerSwitch = util.switch() end end + if not hasMarkDoc and source.type == 'tableindex' then + vm.compileByParentNode(source.node, vm.ANY, function (src) + if src.type == 'doc.field' + or src.type == 'doc.type.field' then + if vm.isSubType(guide.getUri(source), vm.compileNode(source.index), vm.compileNode(src.field or src.name)) then + hasMarkDoc = true + vm.setNode(source, vm.compileNode(src)) + end + end + end) + end + if not hasMarkDoc and source.value then vm.setNode(source, vm.compileNode(source.value)) end |