summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-25 14:25:14 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-25 14:25:14 +0800
commit6e8e0737f5643114ee1bfc5edcb2aeef435ed436 (patch)
tree06224c562547885c3a9adfd0e19c27be1fc3f8ef /script/vm
parent14bf8a0d00cd6e485eff604c67dc21e29b80eef1 (diff)
downloadlua-language-server-6e8e0737f5643114ee1bfc5edcb2aeef435ed436.zip
fix `assert` dose not remove `type nil`
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/node.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/script/vm/node.lua b/script/vm/node.lua
index 8b2bafd7..6023b1c3 100644
--- a/script/vm/node.lua
+++ b/script/vm/node.lua
@@ -131,6 +131,7 @@ function mt:setTruthy()
for index = #self, 1, -1 do
local c = self[index]
if c.type == 'nil'
+ or (c.type == 'global' and c.cate == 'type' and c.name == 'nil')
or (c.type == 'boolean' and c[1] == false)
or (c.type == 'doc.type.boolean' and c[1] == false) then
table.remove(self, index)
@@ -163,6 +164,7 @@ function mt:setFalsy()
for index = #self, 1, -1 do
local c = self[index]
if c.type == 'nil'
+ or (c.type == 'global' and c.cate == 'type' and c.name == 'nil')
or (c.type == 'boolean' and c[1] == true)
or (c.type == 'doc.type.boolean' and c[1] == true) then
goto CONTINUE