blob: 3d32324d8c81da80e7697e034455f126ad240961 (
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 vm = require 'vm'
return function (uri, callback)
local state = files.getAst(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.class' then
if not doc.extends then
goto CONTINUE
end
local myName = searcher.getKeyName(doc)
local list = { doc }
local mark = {}
for i = 1, 999 do
local current = list[i]
if not current then
goto CONTINUE
end
if current.extends then
for _, extend in ipairs(current.extends) do
local newName = extend[1]
if newName == myName then
callback {
start = doc.start,
finish = doc.finish,
message = lang.script('DIAG_CIRCLE_DOC_CLASS', myName)
}
goto CONTINUE
end
if not mark[newName] then
mark[newName] = true
local docs = vm.getDocTypes(newName)
for _, otherDoc in ipairs(docs) do
if otherDoc.type == 'doc.class.name' then
list[#list+1] = otherDoc.parent
end
end
end
end
end
end
::CONTINUE::
end
end
end
|