docs: use new implement based doc API
authorDaniel Kolesa <d.kolesa@osg.samsung.com>
Fri, 20 Jan 2017 14:32:00 +0000 (15:32 +0100)
committerDaniel Kolesa <d.kolesa@osg.samsung.com>
Fri, 20 Jan 2017 14:32:00 +0000 (15:32 +0100)
src/scripts/elua/apps/docgen/doctree.lua
src/scripts/elua/apps/docgen/stats.lua
src/scripts/elua/apps/gendoc.lua

index ad3b9f6..054000b 100644 (file)
@@ -312,28 +312,10 @@ M.Function = Node:clone {
         return self.func:legacy_get(ft)
     end,
 
-    doc_get = function(self, ft)
-        -- TODO: handle overridden docs sanely
-        return M.Doc(self.func:implement_get():documentation_get(ft))
-    end,
-
     implement_get = function(self)
         return M.Implement(self.func:implement_get())
     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_legacy_only = function(self, ft)
         return self.func:is_legacy_only(ft)
     end,
@@ -1296,6 +1278,16 @@ M.Implement = Node:clone {
         return M.Doc(self.impl:documentation_get(ftype))
     end,
 
+    fallback_doc_get = function(self)
+        local ig, is = self:is_prop_get(), self:is_prop_set()
+        if ig and not is then
+            return self:doc_get(M.Function.PROP_GET)
+        elseif is and not ig then
+            return self:doc_get(M.Function.PROP_SET)
+        end
+        return nil
+    end,
+
     is_auto = function(self, ftype)
         return self.impl:is_auto(ftype)
     end,
index 05a82ac..5bbc592 100644 (file)
@@ -145,7 +145,7 @@ M.check_method = function(fn, cl)
             stat_incr("mret", false)
         end
     end
-    if not fn:doc_get(fn.METHOD):exists() then
+    if not fn:implement_get():doc_get(fn.METHOD):exists() then
         print_missing(fulln, "method")
         stat_incr("method", true)
     else
@@ -178,7 +178,9 @@ M.check_property = function(fn, cl, ft)
         end
     end
 
-    if not fn:doc_get(fn.PROPERTY):exists() and not fn:doc_get(ft):exists() then
+    local pimp = fn:implement_get()
+
+    if not pimp:doc_get(fn.PROPERTY):exists() and not pimp:doc_get(ft):exists() then
         print_missing(fulln, pfx .. "etter")
         stat_incr(pfx .. "etter", true)
     else
index ef3800d..1d0ecac 100644 (file)
@@ -174,9 +174,9 @@ local gen_method_sig = function(fn, cl)
     local buf = {}
     gen_func_namesig(fn, cl, buf, false, false, false)
 
-    local pimp = fn:implement_get()
+    local fimp = fn:implement_get()
 
-    if pimp:is_pure_virtual(fn.METHOD) then
+    if fimp:is_pure_virtual(fn.METHOD) then
         buf[#buf + 1] = "@pure_virtual "
     end
     buf[#buf + 1] = "{"
@@ -340,9 +340,10 @@ local build_functable = function(f, title, ctitle, cl, tp)
             lbuf:write_raw(" ")
             lbuf:write_i(pt)
         end
+        local fimp = v:implement_get()
         nt[#nt + 1] = {
             lbuf:finish(),
-            v:doc_get(v.METHOD):brief_get(v:fallback_doc_get())
+            fimp:doc_get(v.METHOD):brief_get(fimp:fallback_doc_get())
         }
         if v:type_str_get() == "property" then
             build_property(v, cl)
@@ -951,7 +952,7 @@ build_method = function(fn, cl)
     end
 
     f:write_h("Description", 2)
-    f:write_raw(fn:doc_get(fn.METHOD):full_get(nil, true))
+    f:write_raw(fn:implement_get():doc_get(fn.METHOD):full_get(nil, true))
     f:write_nl()
 
     f:write_editable(mns, "description")
@@ -971,9 +972,11 @@ build_property = function(fn, cl)
     if isget then stats.check_property(fn, cl, fn.PROP_GET) end
     if isset then stats.check_property(fn, cl, fn.PROP_SET) end
 
-    local doc = fn:doc_get(fn.PROPERTY)
-    local gdoc = fn:doc_get(fn.PROP_GET)
-    local sdoc = fn:doc_get(fn.PROP_SET)
+    local pimp = fn:implement_get()
+
+    local doc = pimp:doc_get(fn.PROPERTY)
+    local gdoc = pimp:doc_get(fn.PROP_GET)
+    local sdoc = pimp:doc_get(fn.PROP_SET)
 
     f:write_h("Signature", 2)
     f:write_code(gen_prop_sig(fn, cl))