diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-09-25 17:42:54 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-09-25 17:42:54 +0800 |
commit | 3036d9d81a5771665e27b1bfe06662d163155b22 (patch) | |
tree | 48062c66c0f7eff3660461d76a0e140ad8bccedc /server-beta/src/core/engineer.lua | |
parent | c08ce9af7a35be058aafabcb5dd88748aae75282 (diff) | |
download | lua-language-server-3036d9d81a5771665e27b1bfe06662d163155b22.zip |
暂存
Diffstat (limited to 'server-beta/src/core/engineer.lua')
-rw-r--r-- | server-beta/src/core/engineer.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/server-beta/src/core/engineer.lua b/server-beta/src/core/engineer.lua index c82efa6d..a093a90a 100644 --- a/server-beta/src/core/engineer.lua +++ b/server-beta/src/core/engineer.lua @@ -87,6 +87,10 @@ function mt:isGlobal(obj) if obj.type == 'getfield' then return self:call('isGlobalField', obj) end + if obj.type == 'call' then + local d = self:call('asRawGet', obj) + return not not d + end return false end @@ -218,6 +222,23 @@ function mt:eachLocalRef(obj, callback) end end +--- 遍历class +function mt:eachClass(obj, callback) + local root = self.ast.root + if obj.type == 'setlocal' or obj.type == 'getlocal' then + local loc = root[obj.loc] + local setmethod = root[loc.method] + if setmethod then + local node = root[setmethod.node] + self:call('eachLocalRef', node, function (src, mode) + if mode == 'local' or mode == 'set' then + callback(src) + end + end) + end + end +end + return function (ast) local self = setmetatable({ step = 0, |