summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-01-20 15:32:00 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-01-20 15:32:00 +0100
commitc2b6fbccbc5f2ab2defe72c9e11d6ac1daac083e (patch)
tree5634c55150db9ddd89d7ce39bb4db73ca45e3b9d
parent8207fd9cc588fb02d7636b60fd1853dd434e088e (diff)
docs: use new implement based doc API
-rw-r--r--src/scripts/elua/apps/docgen/doctree.lua28
-rw-r--r--src/scripts/elua/apps/docgen/stats.lua6
-rw-r--r--src/scripts/elua/apps/gendoc.lua17
3 files changed, 24 insertions, 27 deletions
diff --git a/src/scripts/elua/apps/docgen/doctree.lua b/src/scripts/elua/apps/docgen/doctree.lua
index ad3b9f65db..054000b6d9 100644
--- a/src/scripts/elua/apps/docgen/doctree.lua
+++ b/src/scripts/elua/apps/docgen/doctree.lua
@@ -312,28 +312,10 @@ M.Function = Node:clone {
312 return self.func:legacy_get(ft) 312 return self.func:legacy_get(ft)
313 end, 313 end,
314 314
315 doc_get = function(self, ft)
316 -- TODO: handle overridden docs sanely
317 return M.Doc(self.func:implement_get():documentation_get(ft))
318 end,
319
320 implement_get = function(self) 315 implement_get = function(self)
321 return M.Implement(self.func:implement_get()) 316 return M.Implement(self.func:implement_get())
322 end, 317 end,
323 318
324 fallback_doc_get = function(self, ft)
325 if not ft then
326 local fft = self:type_get()
327 if fft == self.PROP_GET or fft == self.PROP_SET then
328 ft = fft
329 end
330 end
331 if ft then
332 return self:doc_get(ft)
333 end
334 return nil
335 end,
336
337 is_legacy_only = function(self, ft) 319 is_legacy_only = function(self, ft)
338 return self.func:is_legacy_only(ft) 320 return self.func:is_legacy_only(ft)
339 end, 321 end,
@@ -1296,6 +1278,16 @@ M.Implement = Node:clone {
1296 return M.Doc(self.impl:documentation_get(ftype)) 1278 return M.Doc(self.impl:documentation_get(ftype))
1297 end, 1279 end,
1298 1280
1281 fallback_doc_get = function(self)
1282 local ig, is = self:is_prop_get(), self:is_prop_set()
1283 if ig and not is then
1284 return self:doc_get(M.Function.PROP_GET)
1285 elseif is and not ig then
1286 return self:doc_get(M.Function.PROP_SET)
1287 end
1288 return nil
1289 end,
1290
1299 is_auto = function(self, ftype) 1291 is_auto = function(self, ftype)
1300 return self.impl:is_auto(ftype) 1292 return self.impl:is_auto(ftype)
1301 end, 1293 end,
diff --git a/src/scripts/elua/apps/docgen/stats.lua b/src/scripts/elua/apps/docgen/stats.lua
index 05a82ac3f5..5bbc592333 100644
--- a/src/scripts/elua/apps/docgen/stats.lua
+++ b/src/scripts/elua/apps/docgen/stats.lua
@@ -145,7 +145,7 @@ M.check_method = function(fn, cl)
145 stat_incr("mret", false) 145 stat_incr("mret", false)
146 end 146 end
147 end 147 end
148 if not fn:doc_get(fn.METHOD):exists() then 148 if not fn:implement_get():doc_get(fn.METHOD):exists() then
149 print_missing(fulln, "method") 149 print_missing(fulln, "method")
150 stat_incr("method", true) 150 stat_incr("method", true)
151 else 151 else
@@ -178,7 +178,9 @@ M.check_property = function(fn, cl, ft)
178 end 178 end
179 end 179 end
180 180
181 if not fn:doc_get(fn.PROPERTY):exists() and not fn:doc_get(ft):exists() then 181 local pimp = fn:implement_get()
182
183 if not pimp:doc_get(fn.PROPERTY):exists() and not pimp:doc_get(ft):exists() then
182 print_missing(fulln, pfx .. "etter") 184 print_missing(fulln, pfx .. "etter")
183 stat_incr(pfx .. "etter", true) 185 stat_incr(pfx .. "etter", true)
184 else 186 else
diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua
index ef3800db09..1d0ecac6fd 100644
--- a/src/scripts/elua/apps/gendoc.lua
+++ b/src/scripts/elua/apps/gendoc.lua
@@ -174,9 +174,9 @@ local gen_method_sig = function(fn, cl)
174 local buf = {} 174 local buf = {}
175 gen_func_namesig(fn, cl, buf, false, false, false) 175 gen_func_namesig(fn, cl, buf, false, false, false)
176 176
177 local pimp = fn:implement_get() 177 local fimp = fn:implement_get()
178 178
179 if pimp:is_pure_virtual(fn.METHOD) then 179 if fimp:is_pure_virtual(fn.METHOD) then
180 buf[#buf + 1] = "@pure_virtual " 180 buf[#buf + 1] = "@pure_virtual "
181 end 181 end
182 buf[#buf + 1] = "{" 182 buf[#buf + 1] = "{"
@@ -340,9 +340,10 @@ local build_functable = function(f, title, ctitle, cl, tp)
340 lbuf:write_raw(" ") 340 lbuf:write_raw(" ")
341 lbuf:write_i(pt) 341 lbuf:write_i(pt)
342 end 342 end
343 local fimp = v:implement_get()
343 nt[#nt + 1] = { 344 nt[#nt + 1] = {
344 lbuf:finish(), 345 lbuf:finish(),
345 v:doc_get(v.METHOD):brief_get(v:fallback_doc_get()) 346 fimp:doc_get(v.METHOD):brief_get(fimp:fallback_doc_get())
346 } 347 }
347 if v:type_str_get() == "property" then 348 if v:type_str_get() == "property" then
348 build_property(v, cl) 349 build_property(v, cl)
@@ -951,7 +952,7 @@ build_method = function(fn, cl)
951 end 952 end
952 953
953 f:write_h("Description", 2) 954 f:write_h("Description", 2)
954 f:write_raw(fn:doc_get(fn.METHOD):full_get(nil, true)) 955 f:write_raw(fn:implement_get():doc_get(fn.METHOD):full_get(nil, true))
955 f:write_nl() 956 f:write_nl()
956 957
957 f:write_editable(mns, "description") 958 f:write_editable(mns, "description")
@@ -971,9 +972,11 @@ build_property = function(fn, cl)
971 if isget then stats.check_property(fn, cl, fn.PROP_GET) end 972 if isget then stats.check_property(fn, cl, fn.PROP_GET) end
972 if isset then stats.check_property(fn, cl, fn.PROP_SET) end 973 if isset then stats.check_property(fn, cl, fn.PROP_SET) end
973 974
974 local doc = fn:doc_get(fn.PROPERTY) 975 local pimp = fn:implement_get()
975 local gdoc = fn:doc_get(fn.PROP_GET) 976
976 local sdoc = fn:doc_get(fn.PROP_SET) 977 local doc = pimp:doc_get(fn.PROPERTY)
978 local gdoc = pimp:doc_get(fn.PROP_GET)
979 local sdoc = pimp:doc_get(fn.PROP_SET)
977 980
978 f:write_h("Signature", 2) 981 f:write_h("Signature", 2)
979 f:write_code(gen_prop_sig(fn, cl)) 982 f:write_code(gen_prop_sig(fn, cl))