diff options
Diffstat (limited to 'script/vm/value.lua')
-rw-r--r-- | script/vm/value.lua | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/script/vm/value.lua b/script/vm/value.lua index a784be2a..d29ca9d0 100644 --- a/script/vm/value.lua +++ b/script/vm/value.lua @@ -17,7 +17,16 @@ function vm.test(source) hasTrue = true end if n[1] == false then - hasTrue = false + hasFalse = true + end + end + if n.type == 'global' and n.cate == 'type' then + if n.name == 'true' then + hasTrue = true + end + if n.name == 'false' + or n.name == 'nil' then + hasFalse = true end end if n.type == 'nil' then @@ -41,28 +50,9 @@ function vm.test(source) end end ----@param source parser.object ----@return boolean -function vm.isFalsy(source) - if source.type == 'nil' then - return true - end - if source.type == 'boolean' - or source.type == 'doc.type.boolean' then - return source[1] == false - end - return false -end - ---@param v vm.object ---@return string? local function getUnique(v) - if v.type == 'local' then - return ('loc:%s@%d'):format(guide.getUri(v), v.start) - end - if v.type == 'global' then - return ('%s:%s'):format(v.cate, v.name) - end if v.type == 'boolean' then if v[1] == nil then return false |