diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-10-23 17:31:02 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-10-23 17:31:02 +0800 |
commit | 4248038716c6c2281a10af9c0a3f04c6468b1946 (patch) | |
tree | 79361f8df2cf46ab99843e84bba175ea60147da2 /server-beta/src/searcher-old/number.lua | |
parent | 68541432820dfff4554375c4c424a537943a938d (diff) | |
download | lua-language-server-4248038716c6c2281a10af9c0a3f04c6468b1946.zip |
准备换一个写法试试
Diffstat (limited to 'server-beta/src/searcher-old/number.lua')
-rw-r--r-- | server-beta/src/searcher-old/number.lua | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/server-beta/src/searcher-old/number.lua b/server-beta/src/searcher-old/number.lua new file mode 100644 index 00000000..f92670e1 --- /dev/null +++ b/server-beta/src/searcher-old/number.lua @@ -0,0 +1,43 @@ +local guide = require 'parser.guide' + +local m = {} + +function m:eachDef(source, callback) + local parent = source.parent + if not parent then + return + end + if parent.type ~= 'setindex' and parent.type ~= 'getindex' then + return + end + local node = parent.node + local key = guide.getKeyName(source) + self:eachField(node, key, function (info) + if info.mode == 'set' then + callback(info) + end + end) +end + +function m:eachRef(source, callback) + local parent = source.parent + if not parent then + return + end + if parent.type ~= 'setindex' and parent.type ~= 'getindex' then + return + end + local node = parent.node + local key = guide.getKeyName(source) + self:eachField(node, key, function (info) + if info.mode == 'set' or info.mode == 'get' then + callback(info) + end + end) +end + +function m:getValue(source) + return source +end + +return m |