forked from enlightenment/efl
docgen: autodocument inherited methods/properties
This commit is contained in:
parent
ebab91182c
commit
ff8688e169
|
@ -985,7 +985,20 @@ find_parent_impl = function(fulln, cl)
|
||||||
return pimpl, pcl
|
return pimpl, pcl
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- unreachable with a validated database
|
return nil, cl
|
||||||
|
end
|
||||||
|
|
||||||
|
local find_parent_doc
|
||||||
|
find_parent_doc = function(fulln, cl, ftype)
|
||||||
|
local pimpl, pcl = find_parent_impl(fulln, cl)
|
||||||
|
if not pimpl then
|
||||||
|
return dtree.Doc()
|
||||||
|
end
|
||||||
|
local pdoc = pimpl:doc_get(ftype)
|
||||||
|
if not pdoc:exists() then
|
||||||
|
return find_parent_doc(fulln, pcl, ftype)
|
||||||
|
end
|
||||||
|
return pdoc
|
||||||
end
|
end
|
||||||
|
|
||||||
build_method = function(impl, cl)
|
build_method = function(impl, cl)
|
||||||
|
@ -997,30 +1010,28 @@ build_method = function(impl, cl)
|
||||||
|
|
||||||
local doc = impl:doc_get(fn.METHOD)
|
local doc = impl:doc_get(fn.METHOD)
|
||||||
if over and not doc:exists() then
|
if over and not doc:exists() then
|
||||||
local pimpl, pcl = find_parent_impl(impl:full_name_get(), cl)
|
doc = find_parent_doc(impl:full_name_get(), cl, fn.METHOD)
|
||||||
f:write_inherited(fn:nspaces_get(pcl))
|
end
|
||||||
f:write_nl()
|
|
||||||
else
|
|
||||||
f:write_h("Signature", 2)
|
|
||||||
f:write_code(gen_method_sig(fn, cl))
|
|
||||||
f:write_nl()
|
|
||||||
|
|
||||||
f:write_h("C signature", 2)
|
f:write_h("Signature", 2)
|
||||||
f:write_code(gen_func_csig(fn, mns), "c")
|
f:write_code(gen_method_sig(fn, cl))
|
||||||
f:write_nl()
|
f:write_nl()
|
||||||
|
|
||||||
local pars = fn:parameters_get()
|
f:write_h("C signature", 2)
|
||||||
if #pars > 0 then
|
f:write_code(gen_func_csig(fn, mns), "c")
|
||||||
f:write_h("Parameters", 2)
|
f:write_nl()
|
||||||
build_parlist(f, pars)
|
|
||||||
f:write_nl()
|
|
||||||
end
|
|
||||||
|
|
||||||
f:write_h("Description", 2)
|
local pars = fn:parameters_get()
|
||||||
f:write_raw(impl:doc_get(fn.METHOD):full_get(nil, true))
|
if #pars > 0 then
|
||||||
|
f:write_h("Parameters", 2)
|
||||||
|
build_parlist(f, pars)
|
||||||
f:write_nl()
|
f:write_nl()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
f:write_h("Description", 2)
|
||||||
|
f:write_raw(doc:full_get(nil, true))
|
||||||
|
f:write_nl()
|
||||||
|
|
||||||
f:write_editable(mns, "description")
|
f:write_editable(mns, "description")
|
||||||
f:write_nl()
|
f:write_nl()
|
||||||
|
|
||||||
|
@ -1028,13 +1039,13 @@ build_method = function(impl, cl)
|
||||||
end
|
end
|
||||||
|
|
||||||
build_property = function(impl, cl)
|
build_property = function(impl, cl)
|
||||||
|
local over = impl:is_overridden(cl)
|
||||||
local fn = impl:function_get()
|
local fn = impl:function_get()
|
||||||
local pns = fn:nspaces_get(cl)
|
local pns = fn:nspaces_get(cl)
|
||||||
local f = writer.Writer(pns, cl:full_name_get() .. "." .. fn:name_get())
|
local f = writer.Writer(pns, cl:full_name_get() .. "." .. fn:name_get())
|
||||||
|
|
||||||
local ft = fn:type_get()
|
local isget = impl:is_prop_get()
|
||||||
local isget = (ft == fn.PROP_GET or ft == fn.PROPERTY)
|
local isset = impl:is_prop_set()
|
||||||
local isset = (ft == fn.PROP_SET or ft == fn.PROPERTY)
|
|
||||||
|
|
||||||
if isget then stats.check_property(fn, cl, fn.PROP_GET) end
|
if isget then stats.check_property(fn, cl, fn.PROP_GET) end
|
||||||
if isset then stats.check_property(fn, cl, fn.PROP_SET) end
|
if isset then stats.check_property(fn, cl, fn.PROP_SET) end
|
||||||
|
@ -1045,6 +1056,18 @@ build_property = function(impl, cl)
|
||||||
local gdoc = pimp:doc_get(fn.PROP_GET)
|
local gdoc = pimp:doc_get(fn.PROP_GET)
|
||||||
local sdoc = pimp:doc_get(fn.PROP_SET)
|
local sdoc = pimp:doc_get(fn.PROP_SET)
|
||||||
|
|
||||||
|
if over then
|
||||||
|
if not doc:exists() then
|
||||||
|
doc = find_parent_doc(impl:full_name_get(), cl, fn.PROPERTY)
|
||||||
|
end
|
||||||
|
if isget and not gdoc:exists() then
|
||||||
|
gdoc = find_parent_doc(impl:full_name_get(), cl, fn.PROP_GET)
|
||||||
|
end
|
||||||
|
if isset and not sdoc:exists() then
|
||||||
|
sdoc = find_parent_doc(impl:full_name_get(), cl, fn.PROP_SET)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
f:write_h("Signature", 2)
|
f:write_h("Signature", 2)
|
||||||
f:write_code(gen_prop_sig(fn, cl))
|
f:write_code(gen_prop_sig(fn, cl))
|
||||||
f:write_nl()
|
f:write_nl()
|
||||||
|
|
Loading…
Reference in New Issue