docs: namespace generator for funcs in doctree

This commit is contained in:
Daniel Kolesa 2016-08-12 14:16:57 +01:00
parent 6f71222084
commit 6de8a1f131
3 changed files with 22 additions and 13 deletions

View File

@ -260,6 +260,15 @@ M.Function = Node:clone {
return self.func:type_get()
end,
type_str_get = function(self)
return ({
[eolian.function_type.PROPERTY] = "property",
[eolian.function_type.PROP_GET] = "property",
[eolian.function_type.PROP_SET] = "property",
[eolian.function_type.METHOD] = "method"
})[self:type_get()]
end,
scope_get = function(self, ft)
return self.func:scope_get(ft)
end,
@ -330,6 +339,16 @@ M.Function = Node:clone {
is_const = function(self)
return self.func:is_const()
end,
nspaces_get = function(self, cl, root)
local tbl = cl:nspaces_get()
tbl[#tbl + 1] = self:type_str_get()
tbl[#tbl + 1] = self:name_get():lower()
if root then
tbl[#tbl + 1] = true
end
return tbl
end
}

View File

@ -58,16 +58,6 @@ M.gen_nsp_eo = function(eobj, subn, root)
return tbl
end
M.gen_nsp_func = function(fn, cl, root)
local tbl = cl:nspaces_get()
tbl[#tbl + 1] = M.funct_to_str[fn:type_get()]
tbl[#tbl + 1] = fn:name_get():lower()
if root then
tbl[#tbl + 1] = true
end
return tbl
end
M.gen_nsp_ref = function(str, root)
local decl = eolian.declaration_get_by_name(str)
if decl then

View File

@ -367,7 +367,7 @@ local build_functable = function(f, title, ctitle, cl, tp)
local nt = {}
for i, v in ipairs(t) do
local lbuf = writer.Buffer()
lbuf:write_link(eomap.gen_nsp_func(v, cl, true), v:name_get())
lbuf:write_link(v:nspaces_get(cl, true), v:name_get())
local pt = propt_to_type[v:type_get()]
if pt then
lbuf:write_raw(" ")
@ -937,7 +937,7 @@ local build_vallist = function(f, pg, ps, title)
end
build_method = function(fn, cl)
local f = writer.Writer(eomap.gen_nsp_func(fn, cl))
local f = writer.Writer(fn:nspaces_get(cl))
stats.check_method(fn, cl)
f:write_h(cl:full_name_get() .. "." .. fn:name_get(), 2)
@ -965,7 +965,7 @@ build_method = function(fn, cl)
end
build_property = function(fn, cl)
local f = writer.Writer(eomap.gen_nsp_func(fn, cl))
local f = writer.Writer(fn:nspaces_get(cl))
local fts = eolian.function_type
local ft = fn:type_get()