blob: 9490711656fec0790c283efa1732c5999aae9142 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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, callback)
return source
end
return m
|