From c32a8ff125c3349a7a464121a161594f0d33117e Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Mon, 15 Aug 2016 13:38:53 +0100 Subject: [PATCH] docs: integrate fallback func doc into Function --- src/scripts/elua/apps/docgen/doctree.lua | 13 +++++++++++++ src/scripts/elua/apps/gendoc.lua | 19 +++---------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/scripts/elua/apps/docgen/doctree.lua b/src/scripts/elua/apps/docgen/doctree.lua index f9f133f74d..35b1ee5842 100644 --- a/src/scripts/elua/apps/docgen/doctree.lua +++ b/src/scripts/elua/apps/docgen/doctree.lua @@ -292,6 +292,19 @@ M.Function = Node:clone { return M.Doc(self.func:documentation_get(ft)) end, + fallback_doc_get = function(self, ft) + if not ft then + local fft = self:type_get() + if fft == self.PROP_GET or fft == self.PROP_SET then + ft = fft + end + end + if ft then + return self:doc_get(ft) + end + return nil + end, + is_virtual_pure = function(self, ft) return self.func:is_virtual_pure(ft) end, diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua index 071a307493..1aa030d4fb 100644 --- a/src/scripts/elua/apps/gendoc.lua +++ b/src/scripts/elua/apps/gendoc.lua @@ -13,25 +13,12 @@ local dtree = require("docgen.doctree") -- eolian to various doc elements conversions -local get_fallback_fdoc = function(f, ftype) - if not ftype then - local ft = f:type_get() - if ft == f.PROP_GET or ft == f.PROP_SET then - ftype = ft - end - end - if ftype then - return f:doc_get(ftype) - end - return nil -end - local get_brief_fdoc = function(f, ftype) - return f:doc_get(f.METHOD):brief_get(get_fallback_fdoc(f, ftype)) + return f:doc_get(f.METHOD):brief_get(f:fallback_doc_get(ftype)) end local get_full_fdoc = function(f, ftype) - return f:doc_get(f.METHOD):full_get(get_fallback_fdoc(f, ftype)) + return f:doc_get(f.METHOD):full_get(f:fallback_doc_get(ftype)) end local propt_to_type = { @@ -423,7 +410,7 @@ end local write_full_fdoc = function(f, fn, ftype) f:write_raw(fn:doc_get(fn.METHOD) - :full_get(get_fallback_fdoc(fn, ftype), true)) + :full_get(fn:fallback_doc_get(ftype), true)) end local build_inherits