docs: fully utilize Function's type_str_get

This commit is contained in:
Daniel Kolesa 2016-08-12 14:19:32 +01:00
parent 6de8a1f131
commit a621f0bd1a
2 changed files with 7 additions and 10 deletions

View File

@ -3,13 +3,6 @@ local dtree = require("docgen.doctree")
local M = {}
M.funct_to_str = {
[eolian.function_type.PROPERTY] = "property",
[eolian.function_type.PROP_GET] = "property",
[eolian.function_type.PROP_SET] = "property",
[eolian.function_type.METHOD] = "method"
}
M.pdir_to_str = {
[eolian.parameter_dir.IN] = "(in)",
[eolian.parameter_dir.OUT] = "(out)",
@ -115,12 +108,16 @@ M.gen_nsp_ref = function(str, root)
if fn then ftype = fn:type_get() end
end
if not fn or not M.funct_to_str[ftype] then
if fn then
fn = dtree.Function(fn)
end
if not fn or not fn:type_str_get() then
error("invalid reference '" .. str .. "'")
end
local ret = M.gen_nsp_ref(bstr)
ret[#ret + 1] = M.funct_to_str[ftype]
ret[#ret + 1] = fn:type_str_get()
ret[#ret + 1] = fn:name_get():lower()
if root then ret[#ret + 1] = true end
return ret

View File

@ -376,7 +376,7 @@ local build_functable = function(f, title, ctitle, cl, tp)
nt[#nt + 1] = {
lbuf:finish(), get_brief_fdoc(v)
}
if eomap.funct_to_str[v:type_get()] == "property" then
if v:type_str_get() == "property" then
build_property(v, cl)
else
build_method(v, cl)