summaryrefslogtreecommitdiff
path: root/script/vm/compiler.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-01-16 17:00:56 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-01-16 17:00:56 +0800
commit15fa11654114e7451d64a726f6ad9d6abbd92b35 (patch)
tree6b4cf1e91f505713e5e4a21521567f16b14d5cfa /script/vm/compiler.lua
parent158a7588081f480809e5d8b50ef098dc5ff70042 (diff)
downloadlua-language-server-15fa11654114e7451d64a726f6ad9d6abbd92b35.zip
improve type infer of recursion alias
Diffstat (limited to 'script/vm/compiler.lua')
-rw-r--r--script/vm/compiler.lua14
1 files changed, 6 insertions, 8 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index 7a89cbf4..a6eda13e 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -1777,6 +1777,11 @@ local compilerSwitch = util.switch()
return
end
end)
+ : case 'global'
+ : case 'generic'
+ : call(function (source)
+ vm.setNode(source, source)
+ end)
---@param source parser.object
local function compileByNode(source)
@@ -1850,7 +1855,7 @@ local function compileByParentNode(source)
end)
end
----@param source vm.object | vm.variable
+---@param source vm.node.object | vm.variable
---@return vm.node
function vm.compileNode(source)
if not source then
@@ -1866,13 +1871,6 @@ function vm.compileNode(source)
return cache
end
- if source.type == 'generic' then
- vm.setNode(source, source)
- local node = vm.getNode(source)
- ---@cast node -?
- return node
- end
-
---@cast source parser.object
vm.setNode(source, vm.createNode(), true)
if not vm.compileByGlobal(source) then