avoid putting overridden impls in members category unless necessary

The logic here is that user doesn't really care about whether the
function is overridden unless there is a custom documentation
specified for the override, which itself is rare.
This commit is contained in:
Daniel Kolesa 2020-02-13 13:50:48 +01:00
parent bce5c86197
commit 1c68295114
2 changed files with 21 additions and 2 deletions

View File

@ -716,11 +716,30 @@ find_callables = function(cl, omeths, events, written, no_overrides)
end
end
local has_custom_doc = function(impl, cl, no_overrides)
-- we don't care, let it pass
if not no_overrides then
return true
end
-- defined in this class, always has its own doc
if impl:class_get() == cl then
return true
end
-- otherwise check if this has *any* part of doc...
if impl:documentation_get(eolian.function_type.PROP_GET) or
impl:documentation_get(eolian.function_type.PROP_SET) or
impl:documentation_get(eolian.function_type.UNRESOLVED)
then
return true
end
return false
end
M.callables_get = function(cl, no_overrides)
local written = {}
local meths, omeths, evs = {}, {}, {}
for impl in cl:implements_get() do
if not no_overrides or impl:class_get() == cl then
if has_custom_doc(impl, cl, no_overrides) then
local ifunc = impl:function_get()
written[M.obj_id_get(ifunc)] = true
meths[#meths + 1] = { cl, impl }

View File

@ -451,7 +451,7 @@ local build_class = function(cl)
f:write_nl()
end
local meths, omeths, ievs = eoutils.callables_get(cl)
local meths, omeths, ievs = eoutils.callables_get(cl, true)
f:write_h("Members", 2)
write_functable(f, cl, meths, true)