@@ -292,15 +292,16 @@ function _descend(term::AbstractTerminal, interp::CthulhuInterpreter, mi::Method
292292 menu_options = (cursor = ' •' , scroll_wrap = true )
293293 display_CI = true
294294 view_cmd = cthulhu_typed
295+ iostream = term. out_stream:: IO
295296 while true
296297 if override === nothing && optimize && interp. opt[mi]. inferred === nothing
297298 # This was inferred to a pure constant - we have no code to show,
298299 # but make something up that looks plausible.
299300 if display_CI
300- println (term . out_stream :: IO )
301- println (term . out_stream :: IO , " │ ─ $(string (Callsite (- 1 , MICallInfo (mi, interp. opt[mi]. rettype), :invoke ))) " )
302- println (term . out_stream :: IO , " │ return " , Const (interp. opt[mi]. rettype_const))
303- println (term . out_stream :: IO )
301+ println (iostream )
302+ println (iostream , " │ ─ $(string (Callsite (- 1 , MICallInfo (mi, interp. opt[mi]. rettype), :invoke ))) " )
303+ println (iostream , " │ return " , Const (interp. opt[mi]. rettype_const))
304+ println (iostream )
304305 end
305306 callsites = Callsite[]
306307 else
@@ -338,7 +339,7 @@ function _descend(term::AbstractTerminal, interp::CthulhuInterpreter, mi::Method
338339
339340 if display_CI
340341 _remarks = remarks ? get (interp. remarks, mi, nothing ) : nothing
341- printstyled (IOContext (term . out_stream :: IO , :limit => true ), mi. def, ' \n ' ; bold= true )
342+ printstyled (IOContext (iostream , :limit => true ), mi. def, ' \n ' ; bold= true )
342343 if debuginfo == DInfo. compact
343344 str = let debuginfo= debuginfo, src= src, codeinf= codeinf, rt= rt, mi= mi,
344345 iswarn= iswarn, hide_type_stable= hide_type_stable,
@@ -355,9 +356,9 @@ function _descend(term::AbstractTerminal, interp::CthulhuInterpreter, mi::Method
355356 if rmatch != = nothing
356357 str = str[begin : prevind (str, first (rmatch))]
357358 end
358- print (term . out_stream :: IO , str)
359+ print (iostream , str)
359360 else
360- lambda_io = IOContext (term . out_stream :: IO , :SOURCE_SLOTNAMES => Base. sourceinfo_slotnames (codeinf))
361+ lambda_io = IOContext (iostream , :SOURCE_SLOTNAMES => Base. sourceinfo_slotnames (codeinf))
361362 cthulhu_typed (lambda_io, debuginfo, src, rt, mi;
362363 iswarn, hide_type_stable,
363364 remarks= _remarks, inline_cost, type_annotations,
@@ -368,7 +369,7 @@ function _descend(term::AbstractTerminal, interp::CthulhuInterpreter, mi::Method
368369 display_CI = true
369370 end
370371
371- menu = CthulhuMenu (callsites, optimize, iswarn& get (term . out_stream :: IO , :color , false ):: Bool ; menu_options... )
372+ menu = CthulhuMenu (callsites, optimize, iswarn& get (iostream , :color , false ):: Bool ; menu_options... )
372373 usg = usage (view_cmd, optimize, iswarn, hide_type_stable, debuginfo, remarks, inline_cost, type_annotations, CONFIG. enable_highlighter)
373374 cid = request (term, usg, menu)
374375 toggle = menu. toggle
@@ -496,12 +497,12 @@ function _descend(term::AbstractTerminal, interp::CthulhuInterpreter, mi::Method
496497 else
497498 view_cmd = get (CODEVIEWS, toggle, nothing )
498499 @assert ! isnothing (view_cmd) " invalid option $toggle "
499- println (term . out_stream )
500- view_cmd (term . out_stream :: IO , mi, optimize, debuginfo, interp, CONFIG)
500+ println (iostream )
501+ view_cmd (iostream , mi, optimize, debuginfo, interp, CONFIG)
501502 display_CI = false
502503 end
503504 end
504- println (term . out_stream :: IO )
505+ println (iostream )
505506 end
506507end
507508_descend (interp:: CthulhuInterpreter , mi:: MethodInstance ; kwargs... ) =
0 commit comments