blob: f7da7bfc171b11786f275740ede109f2434ff567 (
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
|
local guide = require 'parser.guide'
local m = {}
function m:eachDef(source, callback)
local vararg = source.vararg
if vararg.type == 'call' then
local func = vararg.node
self:eachValue(func, function (info)
self:functionReturnOf(info.source, function ()
end)
end)
end
end
function m:eachValue(source, callback)
local vararg = source.vararg
if vararg.type == 'call' then
local func = vararg.node
if self:getSpecialName(func) == 'setmetatable'
and source.index == 1 then
local t, mt = self:callArgOf(vararg)
self:eachValue(t, callback)
self:eachField(mt, 's|__index', function (info)
if info.mode == 'set' then
info.searcher:eachValue(info.source, callback)
end
end)
end
end
end
return m
|