summaryrefslogtreecommitdiff
path: root/script/vm/node.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-07-07 16:04:02 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-07-07 16:04:02 +0800
commit3150962ceadf0046deb164ab6e042f74029de4eb (patch)
tree2f585975bd6b744d197b78e6c5d12cccc4a162c6 /script/vm/node.lua
parentf5464ddc9a8e043977f27e70d9f1dfc2be56b02e (diff)
downloadlua-language-server-3150962ceadf0046deb164ab6e042f74029de4eb.zip
fix #1294
Diffstat (limited to 'script/vm/node.lua')
-rw-r--r--script/vm/node.lua24
1 files changed, 18 insertions, 6 deletions
diff --git a/script/vm/node.lua b/script/vm/node.lua
index d84b7030..65a2108f 100644
--- a/script/vm/node.lua
+++ b/script/vm/node.lua
@@ -162,17 +162,23 @@ function mt:setTruthy()
self[c] = nil
goto CONTINUE
end
- if (c.type == 'global' and c.cate == 'type' and c.name == 'boolean')
- or (c.type == 'boolean' or c.type == 'doc.type.boolean') then
+ if c.type == 'global' and c.cate == 'type' and c.name == 'boolean' then
hasBoolean = true
table.remove(self, index)
self[c] = nil
goto CONTINUE
end
+ if c.type == 'boolean' or c.type == 'doc.type.boolean' then
+ if c[1] == false then
+ table.remove(self, index)
+ self[c] = nil
+ goto CONTINUE
+ end
+ end
::CONTINUE::
end
if hasBoolean then
- self[#self+1] = vm.declareGlobal('type', 'true')
+ self:merge(vm.declareGlobal('type', 'true'))
end
return self
end
@@ -192,13 +198,19 @@ function mt:setFalsy()
or (c.type == 'doc.type.boolean' and c[1] == false) then
goto CONTINUE
end
- if (c.type == 'global' and c.cate == 'type' and c.name == 'boolean')
- or (c.type == 'boolean' or c.type == 'doc.type.boolean') then
+ if c.type == 'global' and c.cate == 'type' and c.name == 'boolean' then
hasBoolean = true
table.remove(self, index)
self[c] = nil
goto CONTINUE
end
+ if c.type == 'boolean' or c.type == 'doc.type.boolean' then
+ if c[1] == true then
+ table.remove(self, index)
+ self[c] = nil
+ goto CONTINUE
+ end
+ end
if (c.type == 'global' and c.cate == 'type') then
table.remove(self, index)
self[c] = nil
@@ -207,7 +219,7 @@ function mt:setFalsy()
::CONTINUE::
end
if hasBoolean then
- self[#self+1] = vm.declareGlobal('type', 'false')
+ self:merge(vm.declareGlobal('type', 'false'))
end
return self
end