diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-06-23 02:45:02 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-06-23 02:45:02 +0800 |
commit | 0ff98557a45c25d7a49520e57f49561a62300f35 (patch) | |
tree | 41d19002f9051f6d48613271d0edcfe712ae3ea3 /script/vm/node.lua | |
parent | e0e3c9ab6b69b16b8949f93f309461f298038fa4 (diff) | |
download | lua-language-server-0ff98557a45c25d7a49520e57f49561a62300f35.zip |
update
Diffstat (limited to 'script/vm/node.lua')
-rw-r--r-- | script/vm/node.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/script/vm/node.lua b/script/vm/node.lua index 8ed5c027..65a203f8 100644 --- a/script/vm/node.lua +++ b/script/vm/node.lua @@ -81,6 +81,7 @@ end function mt:removeOptional() self:remove 'nil' + return self end ---@return boolean @@ -293,6 +294,24 @@ function mt:hasType(name) return false end +---@param name string +---@return boolean +function mt:hasName(name) + if name == 'nil' and self.optional == true then + return true + end + for _, c in ipairs(self) do + if c.type == 'global' and c.cate == 'type' and c.name == name then + return true + end + if c.type == name then + return true + end + -- TODO + end + return false +end + ---@return fun():vm.object function mt:eachObject() local i = 0 |