diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-14 20:54:24 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-14 20:54:24 +0800 |
commit | 7bf48ded2644c706bd91e20420fe94bba05d2b51 (patch) | |
tree | 4dd4f329b819ec35e604dfab35cd11ce4f43576c /script/vm/node.lua | |
parent | be86f7c2215e0019af84b9d444485e99c5d3e801 (diff) | |
download | lua-language-server-7bf48ded2644c706bd91e20420fe94bba05d2b51.zip |
update runner
Diffstat (limited to 'script/vm/node.lua')
-rw-r--r-- | script/vm/node.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/script/vm/node.lua b/script/vm/node.lua index 76e61192..5086f66d 100644 --- a/script/vm/node.lua +++ b/script/vm/node.lua @@ -2,6 +2,7 @@ local files = require 'files' ---@class vm local vm = require 'vm.vm' local ws = require 'workspace.workspace' +local guide = require 'parser.guide' ---@type table<vm.object, vm.node> vm.nodeCache = {} @@ -105,6 +106,18 @@ function mt:hasFalsy() return false end +function mt:hasKnownType() + for _, c in ipairs(self) do + if c.type == 'global' and c.cate == 'type' then + return true + end + if guide.isLiteral(c) then + return true + end + end + return false +end + ---@return boolean function mt:isNullable() if self.optional then |