blob: 86bf3871c8548d3b14825e9cc4622554a43f74c0 (
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
44
45
46
47
48
49
50
51
52
53
54
55
|
local files = require 'files'
local searcher = require 'core.searcher'
local lang = require 'language'
local define = require 'proto.define'
local vm = require 'vm'
local function hasParamName(func, name)
if not func.args then
return false
end
for _, arg in ipairs(func.args) do
if arg[1] == name then
return true
end
if arg.type == '...' and name == '...' then
return true
end
end
return false
end
return function (uri, callback)
local state = files.getState(uri)
if not state then
return
end
if not state.ast.docs then
return
end
for _, doc in ipairs(state.ast.docs) do
if doc.type ~= 'doc.param' then
goto CONTINUE
end
local binds = doc.bindSources
if not binds then
goto CONTINUE
end
local param = doc.param
local name = param[1]
for _, source in ipairs(binds) do
if source.type == 'function' then
if not hasParamName(source, name) then
callback {
start = param.start,
finish = param.finish,
message = lang.script('DIAG_UNDEFINED_DOC_PARAM', name)
}
end
end
end
::CONTINUE::
end
end
|