diff options
author | AlexCai2019 <89138532+AlexCai2019@users.noreply.github.com> | 2022-05-08 01:43:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-08 01:43:28 +0800 |
commit | 0fd83c4ca9f82a02becab6c304a8a7de75098507 (patch) | |
tree | be9790d9d4823fe728c5b36e94093fe5f42b7725 /script/vm/value.lua | |
parent | 89203efad8c9b5513e05ca4d5696107924865b10 (diff) | |
parent | 67b4c574849d1667e0ecb39c51aeed8e30b43056 (diff) | |
download | lua-language-server-0fd83c4ca9f82a02becab6c304a8a7de75098507.zip |
Merge branch 'sumneko:master' into master
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 |