q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=6f10cb94cd3c7093193161db9c0e13daf64f4bbd

commit 6f10cb94cd3c7093193161db9c0e13daf64f4bbd
Author: Daniel Kolesa <d.kol...@osg.samsung.com>
Date:   Mon Aug 15 14:03:53 2016 +0100

    docs: wrap func params in doctree
---
 src/scripts/elua/apps/docgen/doctree.lua | 65 ++++++++++++++++++++++++++++++--
 src/scripts/elua/apps/docgen/stats.lua   | 12 +++---
 src/scripts/elua/apps/gendoc.lua         | 38 +++++++++----------
 3 files changed, 87 insertions(+), 28 deletions(-)

diff --git a/src/scripts/elua/apps/docgen/doctree.lua 
b/src/scripts/elua/apps/docgen/doctree.lua
index 0808922..e541139 100644
--- a/src/scripts/elua/apps/docgen/doctree.lua
+++ b/src/scripts/elua/apps/docgen/doctree.lua
@@ -335,15 +335,27 @@ M.Function = Node:clone {
     end,
 
     property_keys_get = function(self, ft)
-        return self.func:property_keys_get(ft)
+        local ret = {}
+        for par in self.func:property_keys_get(ft) do
+            ret[#ret + 1] = M.Parameter(par)
+        end
+        return ret
     end,
 
     property_values_get = function(self, ft)
-        return self.func:property_values_get(ft)
+        local ret = {}
+        for par in self.func:property_values_get(ft) do
+            ret[#ret + 1] = M.Parameter(par)
+        end
+        return ret
     end,
 
     parameters_get = function(self)
-        return self.func:parameters_get()
+        local ret = {}
+        for par in self.func:parameters_get() do
+            ret[#ret + 1] = M.Parameter(par)
+        end
+        return ret
     end,
 
     return_type_get = function(self, ft)
@@ -377,6 +389,53 @@ M.Function = Node:clone {
     end
 }
 
+M.Parameter = Node:clone {
+    IN = eolian.parameter_dir.IN,
+    OUT = eolian.parameter_dir.OUT,
+    INOUT = eolian.parameter_dir.INOUT,
+
+    __ctor = function(self, par)
+        self.param = par
+        assert(self.param)
+    end,
+
+    direction_get = function(self)
+        return self.param:direction_get()
+    end,
+
+    type_get = function(self)
+        return self.param:type_get()
+    end,
+
+    default_value_get = function(self)
+        return self.param:default_value_get()
+    end,
+
+    name_get = function(self)
+        return self.param:name_get()
+    end,
+
+    doc_get = function(self)
+        return M.Doc(self.param:documentation_get())
+    end,
+
+    is_nonull = function(self)
+        return self.param:is_nonull()
+    end,
+
+    is_nullable = function(self)
+        return self.param:is_nullable()
+    end,
+
+    is_optional = function(self)
+        return self.param:is_optional()
+    end,
+
+    is_same = function(self, other)
+        return self.param == other.param
+    end
+}
+
 M.Event = Node:clone {
     __ctor = function(self, ev)
         self.event = ev
diff --git a/src/scripts/elua/apps/docgen/stats.lua 
b/src/scripts/elua/apps/docgen/stats.lua
index bb1ad47..895e77d 100644
--- a/src/scripts/elua/apps/docgen/stats.lua
+++ b/src/scripts/elua/apps/docgen/stats.lua
@@ -154,8 +154,8 @@ M.check_method = function(fn, cl)
     else
         stat_incr("method", false)
     end
-    for p in fn:parameters_get() do
-        if not p:documentation_get() then
+    for i, p in ipairs(fn:parameters_get()) do
+        if not p:doc_get():exists() then
             print_missing(fulln .. "." .. p:name_get(), "method parameter")
             stat_incr("param", true)
         else
@@ -188,8 +188,8 @@ M.check_property = function(fn, cl, ft)
         stat_incr(pfx .. "etter", false)
     end
 
-    for p in fn:property_keys_get(ft) do
-        if not p:documentation_get() then
+    for i, p in ipairs(fn:property_keys_get(ft)) do
+        if not p:doc_get():exists() then
             print_missing(fulln .. "." .. p:name_get(), pfx .. "etter key")
             stat_incr(pfx .. "key", true)
         else
@@ -197,8 +197,8 @@ M.check_property = function(fn, cl, ft)
         end
     end
 
-    for p in fn:property_values_get(ft) do
-        if not p:documentation_get() then
+    for i, p in ipairs(fn:property_values_get(ft)) do
+        if not p:doc_get():exists() then
             print_missing(fulln .. "." .. p:name_get(), pfx .. "etter value")
             stat_incr(pfx .. "value", true)
         else
diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua
index 01fbf03..84858d6 100644
--- a/src/scripts/elua/apps/gendoc.lua
+++ b/src/scripts/elua/apps/gendoc.lua
@@ -21,7 +21,7 @@ local propt_to_type = {
 
 local gen_cparam = function(par, out)
     local part = par:type_get()
-    out = out or (par:direction_get() == eolian.parameter_dir.OUT)
+    out = out or (par:direction_get() == par.OUT)
     local tstr = part:c_type_get()
     if out then
         tstr = ser.get_ctype_str(tstr, "*")
@@ -50,7 +50,7 @@ local gen_func_csig = function(f, ftype)
     end
 
     if f:type_get() == f.METHOD then
-        local pars = f:parameters_get():to_array()
+        local pars = f:parameters_get()
         local cnrt = get_func_csig_part(cn, rtype)
         for i = 1, #pars do
             pars[i] = gen_cparam(pars[i])
@@ -59,8 +59,8 @@ local gen_func_csig = function(f, ftype)
         return cnrt .. "(" .. table.concat(pars, ", ") .. ");"
     end
 
-    local keys = f:property_keys_get(ftype):to_array()
-    local vals = f:property_values_get(ftype):to_array()
+    local keys = f:property_keys_get(ftype)
+    local vals = f:property_values_get(ftype)
 
     if ftype == f.PROP_SET then
         local cnrt = get_func_csig_part(cn, rtype)
@@ -131,9 +131,9 @@ local gen_func_param = function(fp, buf, nodir)
     -- TODO: default value
     buf[#buf + 1] = "        "
     local dirs = {
-        [eolian.parameter_dir.IN] = "@in ",
-        [eolian.parameter_dir.OUT] = "@out ",
-        [eolian.parameter_dir.INOUT] = "@inout ",
+        [dtree.Parameter.IN] = "@in ",
+        [dtree.Parameter.OUT] = "@out ",
+        [dtree.Parameter.INOUT] = "@inout ",
     }
     if not nodir then buf[#buf + 1] = dirs[fp:direction_get()] end
     buf[#buf + 1] = fp:name_get()
@@ -184,7 +184,7 @@ local gen_method_sig = function(fn, cl)
         buf[#buf + 1] = "@virtual_pure "
     end
     buf[#buf + 1] = "{"
-    local params = fn:parameters_get():to_array()
+    local params = fn:parameters_get()
     local rtp = fn:return_type_get(fn.METHOD)
     if #params == 0 and not rtp then
         buf[#buf + 1] = "}"
@@ -241,10 +241,10 @@ local gen_prop_sig = function(fn, cl)
         buf[#buf + 1] = "@virtual_pure "
     end
 
-    local gkeys = isget and fn:property_keys_get(fn.PROP_GET):to_array() or {}
-    local skeys = isset and fn:property_keys_get(fn.PROP_SET):to_array() or {}
-    local gvals = isget and fn:property_values_get(fn.PROP_GET):to_array() or 
{}
-    local svals = isget and fn:property_values_get(fn.PROP_SET):to_array() or 
{}
+    local gkeys = isget and fn:property_keys_get(fn.PROP_GET) or {}
+    local skeys = isset and fn:property_keys_get(fn.PROP_SET) or {}
+    local gvals = isget and fn:property_values_get(fn.PROP_GET) or {}
+    local svals = isget and fn:property_values_get(fn.PROP_SET) or {}
     local grtt = isget and fn:return_type_get(fn.PROP_GET) or nil
     local srtt = isset and fn:return_type_get(fn.PROP_SET) or nil
 
@@ -866,7 +866,7 @@ local build_parlist = function(f, pl, nodir)
             buf:write_raw(" ")
             buf:write_i(eomap.pdir_to_str[p:direction_get()])
         end
-        buf:write_raw(" - ", dtree.Doc(p:documentation_get()):full_get())
+        buf:write_raw(" - ", p:doc_get():full_get())
         params[#params + 1] = buf:finish()
     end
     f:write_list(params)
@@ -876,7 +876,7 @@ local build_vallist = function(f, pg, ps, title)
     if #pg == #ps then
         local same = true
         for i = 1, #pg do
-            if pg[i] ~= ps[i] then
+            if not pg[i]:is_same(ps[i]) then
                 same = false
                 break
             end
@@ -914,7 +914,7 @@ build_method = function(fn, cl)
     f:write_code(gen_func_csig(fn), "c")
     f:write_nl()
 
-    local pars = fn:parameters_get():to_array()
+    local pars = fn:parameters_get()
     if #pars > 0 then
         f:write_h("Parameters", 3)
         build_parlist(f, pars)
@@ -959,12 +959,12 @@ build_property = function(fn, cl)
     f:write_code(table.concat(codes, "\n"), "c")
     f:write_nl()
 
-    local pgkeys = isget and fn:property_keys_get(fn.PROP_GET):to_array() or {}
-    local pskeys = isset and fn:property_keys_get(fn.PROP_SET):to_array() or {}
+    local pgkeys = isget and fn:property_keys_get(fn.PROP_GET) or {}
+    local pskeys = isset and fn:property_keys_get(fn.PROP_SET) or {}
     build_vallist(f, pgkeys, pskeys, "Keys")
 
-    local pgvals = isget and fn:property_values_get(fn.PROP_GET):to_array() or 
{}
-    local psvals = isset and fn:property_values_get(fn.PROP_SET):to_array() or 
{}
+    local pgvals = isget and fn:property_values_get(fn.PROP_GET) or {}
+    local psvals = isset and fn:property_values_get(fn.PROP_SET) or {}
     build_vallist(f, pgvals, psvals, "Values")
 
     if isget and isset then

-- 


Reply via email to