summaryrefslogtreecommitdiff
path: root/script/vm/node.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-12-15 16:46:59 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-12-15 16:46:59 +0800
commit244a19d365d8b3d3881492e08fefa9847bd11a2f (patch)
treeb71dfe508b14015690a824be3d0f7f57ff1fba16 /script/vm/node.lua
parent0ab880ea3e3ef74c91dc56e449b4b7d60d654d8f (diff)
downloadlua-language-server-244a19d365d8b3d3881492e08fefa9847bd11a2f.zip
add supports for merging with `ifblock`
Diffstat (limited to 'script/vm/node.lua')
-rw-r--r--script/vm/node.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/script/vm/node.lua b/script/vm/node.lua
index 2e408128..d0fd5ffb 100644
--- a/script/vm/node.lua
+++ b/script/vm/node.lua
@@ -188,9 +188,6 @@ end
---@return vm.node
function mt:setFalsy()
- if self.optional == false then
- self.optional = nil
- end
local hasBoolean
for index = #self, 1, -1 do
local c = self[index]
@@ -229,6 +226,10 @@ function mt:setFalsy()
if hasBoolean then
self:merge(vm.declareGlobal('type', 'false'))
end
+ if self.optional then
+ self.optional = nil
+ self:merge(vm.declareGlobal('type', 'nil'))
+ end
return self
end