@@ -42,12 +42,13 @@ local function asDocTypeName(source)
4242end
4343
4444--- @async
45- local function asValue (source , title )
45+ --- @param level integer
46+ local function asValue (source , title , level )
4647 local name = buildName (source , false ) or ' '
4748 local ifr = vm .getInfer (source )
4849 local type = ifr :view (guide .getUri (source ))
4950 local literal = ifr :viewLiterals ()
50- local cont = buildTable (source )
51+ local cont = buildTable (source , level )
5152 local pack = {}
5253 pack [# pack + 1 ] = title
5354 pack [# pack + 1 ] = name .. ' :'
@@ -73,7 +74,8 @@ local function asValue(source, title)
7374end
7475
7576--- @async
76- local function asLocal (source )
77+ --- @param level integer
78+ local function asLocal (source , level )
7779 local node
7880 if source .type == ' local'
7981 or source .type == ' self' then
@@ -82,20 +84,21 @@ local function asLocal(source)
8284 node = source .node
8385 end
8486 if node .type == ' self' then
85- return asValue (source , ' (self)' )
87+ return asValue (source , ' (self)' , level )
8688 end
8789 if node .parent .type == ' funcargs' then
88- return asValue (source , ' (parameter)' )
90+ return asValue (source , ' (parameter)' , level )
8991 elseif guide .getParentFunction (source ) ~= guide .getParentFunction (node ) then
90- return asValue (source , ' (upvalue)' )
92+ return asValue (source , ' (upvalue)' , level )
9193 else
92- return asValue (source , ' local' )
94+ return asValue (source , ' local' , level )
9395 end
9496end
9597
9698--- @async
97- local function asGlobal (source )
98- return asValue (source , ' (global)' )
99+ --- @param level integer
100+ local function asGlobal (source , level )
101+ return asValue (source , ' (global)' , level )
99102end
100103
101104local function isGlobalField (source )
@@ -126,11 +129,12 @@ local function isGlobalField(source)
126129end
127130
128131--- @async
129- local function asField (source )
132+ --- @param level integer
133+ local function asField (source , level )
130134 if isGlobalField (source ) then
131- return asGlobal (source )
135+ return asGlobal (source , level )
132136 end
133- return asValue (source , ' (field)' )
137+ return asValue (source , ' (field)' , level )
134138end
135139
136140local function asDocFieldName (source )
@@ -192,26 +196,27 @@ local function asNumber(source)
192196end
193197
194198--- @async
195- return function (source , oop )
199+ --- @param level integer
200+ return function (source , oop , level )
196201 if source .type == ' function'
197202 or source .type == ' doc.type.function' then
198203 return asFunction (source , oop )
199204 elseif source .type == ' local'
200205 or source .type == ' self'
201206 or source .type == ' getlocal'
202207 or source .type == ' setlocal' then
203- return asLocal (source )
208+ return asLocal (source , level )
204209 elseif source .type == ' setglobal'
205210 or source .type == ' getglobal' then
206- return asGlobal (source )
211+ return asGlobal (source , level )
207212 elseif source .type == ' getfield'
208213 or source .type == ' setfield'
209214 or source .type == ' getmethod'
210215 or source .type == ' setmethod'
211216 or source .type == ' tablefield'
212217 or source .type == ' field'
213218 or source .type == ' method' then
214- return asField (source )
219+ return asField (source , level )
215220 elseif source .type == ' string' then
216221 return asString (source )
217222 elseif source .type == ' number'
0 commit comments