@@ -4,16 +4,25 @@ local vm = require 'vm'
44local lang = require ' language'
55local await = require ' await'
66
7- local function hasDocReturn (func )
8- if not func .bindDocs then
9- return false
7+ --- @param func parser.object
8+ --- @return number
9+ local function getReturnsMax (func )
10+ local _ , max = vm .countReturnsOfFunction (func , true )
11+ if max == math.huge then
12+ return max
1013 end
1114 for _ , doc in ipairs (func .bindDocs ) do
12- if doc .type == ' doc.return' then
13- return true
15+ if doc .type == ' doc.overload' then
16+ local _ , n = vm .countReturnsOfFunction (doc .overload )
17+ if n == math.huge then
18+ return n
19+ end
20+ if n > max then
21+ max = n
22+ end
1423 end
1524 end
16- return false
25+ return max
1726end
1827
1928--- @async
@@ -25,15 +34,12 @@ return function (uri, callback)
2534
2635 --- @async
2736 guide .eachSourceType (state .ast , ' function' , function (source )
28- await .delay ()
29- if not hasDocReturn (source ) then
30- return
31- end
32- local _ , max = vm .countReturnsOfFunction (source )
3337 local returns = source .returns
3438 if not returns then
3539 return
3640 end
41+ await .delay ()
42+ local max = getReturnsMax (source )
3743 for _ , ret in ipairs (returns ) do
3844 local rmin , rmax = vm .countList (ret )
3945 if rmin > max then
0 commit comments