summaryrefslogtreecommitdiff
path: root/script/vm/compiler.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2023-01-11 17:22:28 +0800
committer最萌小汐 <sumneko@hotmail.com>2023-01-11 17:22:28 +0800
commit809fa70f72712f778ecebd67cd9ba725a21313f1 (patch)
tree0fea5b3798b6b4e83cc7a132625a77ccd99ff58a /script/vm/compiler.lua
parent5188c59384eee1b0a58b041f877c983788e9c3bf (diff)
downloadlua-language-server-809fa70f72712f778ecebd67cd9ba725a21313f1.zip
stash
Diffstat (limited to 'script/vm/compiler.lua')
-rw-r--r--script/vm/compiler.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/script/vm/compiler.lua b/script/vm/compiler.lua
index dbcb403d..6212850a 100644
--- a/script/vm/compiler.lua
+++ b/script/vm/compiler.lua
@@ -716,13 +716,13 @@ function vm.selectNode(list, index)
local result
if exp.type == 'call' then
result = getReturn(exp.node, index, exp.args)
- if result:isEmpty() then
+ if not result:isTyped() then
result:merge(vm.declareGlobal('type', 'unknown'))
end
else
---@type vm.node
result = vm.compileNode(exp)
- if result:isEmpty() then
+ if not result:isTyped() then
result:merge(vm.declareGlobal('type', 'unknown'))
end
end
@@ -1526,7 +1526,7 @@ local compilerSwitch = util.switch()
if not node then
return
end
- if node:isEmpty() then
+ if not node:isTyped() then
node = vm.runOperator('call', vararg.node) or node
end
vm.setNode(source, node)
@@ -1547,7 +1547,7 @@ local compilerSwitch = util.switch()
if not node then
return
end
- if node:isEmpty() then
+ if not node:isTyped() then
node = vm.runOperator('call', source.node) or node
end
vm.setNode(source, node)
@@ -1829,7 +1829,7 @@ end
---@param source vm.object
local function compileByParentNode(source)
- if not vm.getNode(source):isEmpty() then
+ if vm.getNode(source):isTyped() then
return
end
vm.compileByNodeChain(source, function (result)
@@ -1837,7 +1837,7 @@ local function compileByParentNode(source)
end)
end
----@param source vm.object
+---@param source vm.object | vm.variable
---@return vm.node
function vm.compileNode(source)
if not source then
@@ -1863,6 +1863,7 @@ function vm.compileNode(source)
---@cast source parser.object
vm.setNode(source, vm.createNode(), true)
vm.compileByGlobal(source)
+ vm.compileByVariable(source)
compileByNode(source)
compileByParentNode(source)
matchCall(source)