diff options
author | sumneko <sumneko@hotmail.com> | 2022-03-11 18:05:49 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2022-03-11 18:05:49 +0800 |
commit | e665f6f914eec9e3beca165f1ad7ff432573c740 (patch) | |
tree | 6c9c5fed6a5c68a8afe6e984617f43c093821883 /script | |
parent | 341949e632439b76485f4707155df93f9dd4b258 (diff) | |
download | lua-language-server-e665f6f914eec9e3beca165f1ad7ff432573c740.zip |
update
Diffstat (limited to 'script')
-rw-r--r-- | script/vm/compiler.lua | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua index c70f5d84..af810e19 100644 --- a/script/vm/compiler.lua +++ b/script/vm/compiler.lua @@ -261,11 +261,12 @@ local function getReturn(func, index, args) end local node = m.compileNode(func) ---@type vm.node.union - local result + local result, hasCalled if node then for cnode in nodeMgr.eachNode(node) do if cnode.type == 'function' or cnode.type == 'doc.type.function' then + hasCalled = true local returnNode = getReturnOfFunction(cnode, index) if returnNode and returnNode.type == 'generic' then returnNode = returnNode:resolve(args) @@ -277,6 +278,9 @@ local function getReturn(func, index, args) end end end + if not hasCalled then + result = globalMgr.getGlobal('type', 'unknown') + end return result end @@ -374,7 +378,9 @@ local function selectNode(source, list, index) end result = result or m.compileNode(exp) - or union() + if not result then + return nodeMgr.setNode(source, result) + end local hasKnownType for n in nodeMgr.eachNode(result) do if guide.isLiteral(n) |