Modules may return a single _function_ (see tests/funmod.lua)

This commit is contained in:
Steve Donovan 2016-06-27 11:06:29 +02:00
parent ebdbf7d0e3
commit ff60cbd7aa
2 changed files with 19 additions and 3 deletions

View File

@ -292,18 +292,21 @@ local function parse_file(fname, lang, package, args)
end
if item_follows or comment_contains_tags(comment,args) then
tags = extract_tags(comment,args)
-- explicitly named @module (which is recommended)
if doc.project_level(tags.class) then
module_found = tags.name
-- might be a module returning a single function!
if tags.param or tags['return'] then
local parms, ret, summ = tags.param, tags['return'],tags.summary
local name = tags.name
tags.param = nil
tags['return'] = nil
tags.summary = nil
add_module(tags,tags.name,false)
tags['class'] = nil
tags['name'] = nil
add_module(tags,name,false)
tags = {
summary = summ,
summary = '',
name = 'returns...',
class = 'function',
['return'] = ret,

13
tests/funmod.lua Normal file
View File

@ -0,0 +1,13 @@
-------
-- Summing values.
-- Returns a single function.
-- @param a first
-- @param b second
-- @param c third
-- @return sum of parameters
-- @module funmod
return function(a,b,c)
return a + b + c
end