q66 pushed a commit to branch master.

http://git.enlightenment.org/tools/edocgen.git/commit/?id=e36d53542c9463ab8ab7ea7510f06a69fc1d6068

commit e36d53542c9463ab8ab7ea7510f06a69fc1d6068
Author: Daniel Kolesa <[email protected]>
Date:   Thu Jan 30 16:50:40 2020 +0100

    callables_get: allow ignoring of implementations
---
 docgen/eolian_utils.lua | 34 +++++++++++++++++++---------------
 gendoc.lua              |  2 +-
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/docgen/eolian_utils.lua b/docgen/eolian_utils.lua
index 720ceba..a67cd1c 100644
--- a/docgen/eolian_utils.lua
+++ b/docgen/eolian_utils.lua
@@ -685,13 +685,15 @@ end
 -- overrides and not duplicating, does a depth-first search
 local find_callables
 
-local callable_cb = function(pcl, omeths, events, written)
+local callable_cb = function(pcl, omeths, events, written, no_overrides)
     for impl in pcl:implements_get() do
-        local func = impl:function_get()
-        local fid = M.obj_id_get(func)
-        if not written[fid] then
-            omeths[#omeths + 1] = { pcl, impl }
-            written[fid] = true
+        if not no_overrides or impl:class_get() == pcl then
+            local func = impl:function_get()
+            local fid = M.obj_id_get(func)
+            if not written[fid] then
+                omeths[#omeths + 1] = { pcl, impl }
+                written[fid] = true
+            end
         end
     end
     for ev in pcl:events_get() do
@@ -701,28 +703,30 @@ local callable_cb = function(pcl, omeths, events, written)
             written[evid] = true
         end
     end
-    find_callables(pcl, omeths, events, written)
+    find_callables(pcl, omeths, events, written, no_overrides)
 end
 
-find_callables = function(cl, omeths, events, written)
+find_callables = function(cl, omeths, events, written, no_overrides)
     local pcl = cl:parent_get()
     if pcl then
-        callable_cb(pcl, omeths, events, written)
+        callable_cb(pcl, omeths, events, written, no_overrides)
     end
     for pcl in cl:extensions_get() do
-        callable_cb(pcl, omeths, events, written)
+        callable_cb(pcl, omeths, events, written, no_overrides)
     end
 end
 
-M.callables_get = function(cl)
+M.callables_get = function(cl, no_overrides)
     local written = {}
     local meths, omeths, evs = {}, {}, {}
     for impl in cl:implements_get() do
-        local ifunc = impl:function_get()
-        written[M.obj_id_get(ifunc)] = true
-        meths[#meths + 1] = { cl, impl }
+        if not no_overrides or impl:class_get() == cl then
+            local ifunc = impl:function_get()
+            written[M.obj_id_get(ifunc)] = true
+            meths[#meths + 1] = { cl, impl }
+        end
     end
-    find_callables(cl, omeths, evs, written)
+    find_callables(cl, omeths, evs, written, no_overrides)
     return meths, omeths, evs
 end
 
diff --git a/gendoc.lua b/gendoc.lua
index c4bb2a4..0ace4c4 100644
--- a/gendoc.lua
+++ b/gendoc.lua
@@ -443,7 +443,7 @@ local build_class = function(cl)
         f:write_h("Inheritance", 2)
 
         f:write_raw(build_inherit_summary(inherits[1]):finish())
-       f:write_nl()
+        f:write_nl()
 
         f:write_folded("Full hierarchy", function()
             f:write_list(build_inherits(cl))

-- 


Reply via email to