diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-11-10 00:15:33 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-11-10 00:15:33 +0800 |
commit | 2a9570cac436f4015453cef839600e5cf5f3f372 (patch) | |
tree | a18617ae63952f08f85d7b8943561d2059a5436b /script/vm/node.lua | |
parent | 63168b71c091c154c8fdd65e9360755c15395fb7 (diff) | |
download | lua-language-server-2a9570cac436f4015453cef839600e5cf5f3f372.zip |
fix #1679
Diffstat (limited to 'script/vm/node.lua')
-rw-r--r-- | script/vm/node.lua | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/script/vm/node.lua b/script/vm/node.lua index 3866e56a..c07269ab 100644 --- a/script/vm/node.lua +++ b/script/vm/node.lua @@ -246,7 +246,8 @@ function mt:remove(name) or (c.type == 'doc.type.table' and name == 'table') or (c.type == 'doc.type.array' and name == 'table') or (c.type == 'doc.type.sign' and name == c.node[1]) - or (c.type == 'doc.type.function' and name == 'function') then + or (c.type == 'doc.type.function' and name == 'function') + or (c.type == 'doc.type.string' and name == 'string') then table.remove(self, index) self[c] = nil end @@ -254,9 +255,10 @@ function mt:remove(name) return self end +---@param uri uri ---@param name string -function mt:narrow(name) - if name ~= 'nil' and self.optional == true then +function mt:narrow(uri, name) + if self.optional == true then self.optional = nil end for index = #self, 1, -1 do @@ -267,12 +269,13 @@ function mt:narrow(name) or (c.type == 'doc.type.table' and name == 'table') or (c.type == 'doc.type.array' and name == 'table') or (c.type == 'doc.type.sign' and name == c.node[1]) - or (c.type == 'doc.type.function' and name == 'function') then + or (c.type == 'doc.type.function' and name == 'function') + or (c.type == 'doc.type.string' and name == 'string') 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 + or (vm.isSubType(uri, c.name, name)) then goto CONTINUE end end |