diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-01-11 17:22:28 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-01-11 17:22:28 +0800 |
commit | 809fa70f72712f778ecebd67cd9ba725a21313f1 (patch) | |
tree | 0fea5b3798b6b4e83cc7a132625a77ccd99ff58a /script/vm/node.lua | |
parent | 5188c59384eee1b0a58b041f877c983788e9c3bf (diff) | |
download | lua-language-server-809fa70f72712f778ecebd67cd9ba725a21313f1.zip |
stash
Diffstat (limited to 'script/vm/node.lua')
-rw-r--r-- | script/vm/node.lua | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/script/vm/node.lua b/script/vm/node.lua index d45ed6a7..f6d86949 100644 --- a/script/vm/node.lua +++ b/script/vm/node.lua @@ -9,7 +9,7 @@ local util = require 'utility' ---@type table<vm.object, vm.node> vm.nodeCache = setmetatable({}, util.MODE_K) ----@alias vm.node.object vm.object | vm.global +---@alias vm.node.object vm.object | vm.global | vm.variable ---@class vm.node ---@field [integer] vm.node.object @@ -58,6 +58,19 @@ function mt:isEmpty() return #self == 0 end +---@return boolean +function mt:isTyped() + for _, c in ipairs(self) do + if c.type == 'global' and c.cate == 'variable' then + return true + end + if guide.isLiteral(c) then + return true + end + end + return false +end + function mt:clear() self.optional = nil for i, c in ipairs(self) do @@ -278,7 +291,7 @@ function mt:narrow(uri, name) return self end ----@param obj vm.object +---@param obj vm.object | vm.variable function mt:removeObject(obj) for index, c in ipairs(self) do if c == obj then |