summaryrefslogtreecommitdiff
path: root/script/vm/node.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-04-21 04:04:03 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-04-21 04:04:03 +0800
commita19f2ee7394c5f5a10342a37497fbd7b7587316c (patch)
tree26a731c7260ec16e5f293840a6204d1b7370b3f0 /script/vm/node.lua
parent0f0ebf434687ac3b085aa0a58d7d87f65f715464 (diff)
downloadlua-language-server-a19f2ee7394c5f5a10342a37497fbd7b7587316c.zip
update narrow
Diffstat (limited to 'script/vm/node.lua')
-rw-r--r--script/vm/node.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/script/vm/node.lua b/script/vm/node.lua
index a4e22b68..81d9f335 100644
--- a/script/vm/node.lua
+++ b/script/vm/node.lua
@@ -123,6 +123,29 @@ function mt:copyTruly()
return newNode
end
+---@param name string
+---@return vm.node
+function mt:copyWithout(name)
+ local newNode = vm.createNode()
+ if self:isOptional() then
+ newNode:addOptional()
+ end
+ for _, c in ipairs(self) do
+ if (c.type == 'global' and c.cate == 'type' and c.name == name)
+ or (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')
+ or (c.type == 'doc.type.array' and name == 'table')
+ or (c.type == 'doc.type.function' and name == 'function') then
+ goto CONTINUE
+ end
+ newNode:merge(c)
+ ::CONTINUE::
+ end
+ return newNode
+end
+
---@return fun():vm.object
function mt:eachObject()
local i = 0