docs: integrate fallback func doc into Function

This commit is contained in:
Daniel Kolesa 2016-08-15 13:38:53 +01:00
parent aa5068d1e2
commit c32a8ff125
2 changed files with 16 additions and 16 deletions

View File

@ -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,

View File

@ -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