docs: reverse inheritance hierarchy api in doctree

This commit is contained in:
Daniel Kolesa 2017-02-09 15:25:10 +01:00
parent 3f50c73031
commit 051f277be2
1 changed files with 18 additions and 0 deletions

View File

@ -144,6 +144,8 @@ M.Doc = Node:clone {
end
}
local revh = {}
M.Class = Node:clone {
-- class types
UNKNOWN = eolian.class_type.UNKNOWN,
@ -207,6 +209,10 @@ M.Class = Node:clone {
return self.class:inherits_get():to_array()
end,
children_get = function(self)
return revh[self:full_name_get()]
end,
functions_get = function(self, ft)
local ret = {}
for fn in self.class:functions_get(ft) do
@ -1403,6 +1409,18 @@ M.parse = function()
if not eolian.all_eo_files_parse() then
error("failed parsing eo files")
end
-- build reverse inheritance hierarchy
for cl in eolian.all_classes_get() do
local cln = cl:full_name_get()
for icl in cl:inherits_get() do
local t = revh[icl]
if not t then
t = {}
revh[icl] = t
end
t[#t + 1] = cln
end
end
end
return M