diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-04-24 05:46:51 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-04-24 05:46:51 +0800 |
commit | f8551a93927ab782ddd58397f86580dc6301a4be (patch) | |
tree | cba5bb076c6b1d360ebf5306cebb491f28a40c8d /script/vm | |
parent | b390ad6411478c2cccadd9750b01971052a7e2c4 (diff) | |
download | lua-language-server-f8551a93927ab782ddd58397f86580dc6301a4be.zip |
`setlocal` can be marked by `---@type`
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/compiler.lua | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index c7d559b5..d764c91d 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -976,6 +976,14 @@ local compilerSwitch = util.switch() local runner = vm.createRunner(source) runner:launch(function (src, node) if src.type == 'setlocal' then + if src.bindDocs then + for _, doc in ipairs(src.bindDocs) do + if doc.type == 'doc.type' then + vm.setNode(src, vm.compileNode(doc), true) + return + end + end + end if src.value and guide.isLiteral(src.value) then if src.value.type == 'table' then vm.setNode(src, vm.createNode(src.value), true) @@ -1260,6 +1268,9 @@ local compilerSwitch = util.switch() local uri = guide.getUri(source) vm.setNode(source, source) local global = globalMgr.getGlobal('type', source.node[1]) + if not global then + return + end for _, set in ipairs(global:getSets(uri)) do if set.type == 'doc.class' then if set.extends then |