docs: integrate fallback func doc into Function
authorDaniel Kolesa <d.kolesa@osg.samsung.com>
Mon, 15 Aug 2016 12:38:53 +0000 (13:38 +0100)
committerDaniel Kolesa <d.kolesa@osg.samsung.com>
Mon, 15 Aug 2016 12:38:53 +0000 (13:38 +0100)
src/scripts/elua/apps/docgen/doctree.lua
src/scripts/elua/apps/gendoc.lua

index f9f133f..35b1ee5 100644 (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,
index 071a307..1aa030d 100644 (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