diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-23 03:32:57 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-23 03:32:57 +0800 |
commit | 420812ce4e77ff4143437b2893dd77fc729c7622 (patch) | |
tree | 92293fc9ab871147060130e432819ea3c3e6f6b9 /script/vm/node.lua | |
parent | 838ce36fdd7abdff0b4cab5e67c2500325178805 (diff) | |
download | lua-language-server-420812ce4e77ff4143437b2893dd77fc729c7622.zip |
update
Diffstat (limited to 'script/vm/node.lua')
-rw-r--r-- | script/vm/node.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/script/vm/node.lua b/script/vm/node.lua index 65a203f8..24f87a45 100644 --- a/script/vm/node.lua +++ b/script/vm/node.lua @@ -9,6 +9,7 @@ vm.nodeCache = {} ---@class vm.node ---@field [integer] vm.object +---@field [vm.object] true local mt = {} mt.__index = mt mt.id = 0 @@ -234,8 +235,7 @@ function mt:narrow(name) end for index = #self, 1, -1 do local c = self[index] - if (c.type == 'global' and c.cate == 'type' and c.name == name) - or (c.type == name) + if (c.type == name) or (c.type == 'doc.type.integer' and (name == 'number' or name == 'integer')) or (c.type == 'doc.type.boolean' and name == 'boolean') or (c.type == 'doc.type.table' and name == 'table') @@ -243,6 +243,12 @@ function mt:narrow(name) or (c.type == 'doc.type.function' and name == 'function') then goto CONTINUE end + if c.type == 'global' and c.cate == 'type' then + if (c.name == name) + or (c.name == 'integer' and name == 'number') then + goto CONTINUE + end + end table.remove(self, index) self[c] = nil ::CONTINUE:: @@ -268,6 +274,7 @@ end function mt:removeNode(node) for _, c in ipairs(node) do if c.type == 'global' and c.cate == 'type' then + ---@cast c vm.global self:remove(c.name) elseif c.type == 'nil' then self:remove 'nil' |