blob: 1dff575ba04b1d3b4ef0b5127bbe2c882c8b52e9 (
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
|
local files = require 'files'
local guide = require 'parser.guide'
local lang = require 'language'
local vm = require "vm.vm"
---@param source parser.object
---@return boolean
local function isBindDoc(source)
if not source.bindDocs then
return false
end
for _, doc in ipairs(source.bindDocs) do
if doc.type == 'doc.type'
or doc.type == 'doc.class' then
return true
end
end
return false
end
return function (uri, callback)
local state = files.getState(uri)
if not state then
return
end
guide.eachSourceType(state.ast, 'getglobal', function (source)
if source.node.tag == '_ENV' then
return
end
if not isBindDoc(source.node) then
return
end
if #vm.getDefs(source) > 0 then
return
end
local key = source[1]
callback {
start = source.start,
finish = source.finish,
message = lang.script('DIAG_UNDEF_ENV_CHILD', key),
}
end)
end
|