@@ -984,18 +984,29 @@ function sourceinfo_slotnames(src::CodeInfo)
984984 return printnames
985985end
986986
987- function show (io:: IO , l:: Core.MethodInstance )
987+ show (io:: IO , l:: Core.MethodInstance ) = show_mi (io, l)
988+
989+ function show_mi (io:: IO , l:: Core.MethodInstance , from_stackframe:: Bool = false )
988990 def = l. def
989991 if isa (def, Method)
990992 if isdefined (def, :generator ) && l === def. generator
991993 print (io, " MethodInstance generator for " )
992994 show (io, def)
993995 else
994996 print (io, " MethodInstance for " )
995- show_tuple_as_call (io, def. name, l. specTypes)
997+ show_tuple_as_call (io, def. name, l. specTypes, false , nothing , nothing , true )
996998 end
997999 else
9981000 print (io, " Toplevel MethodInstance thunk" )
1001+ # `thunk` is not very much information to go on. If this
1002+ # MethodInstance is part of a stacktrace, it gets location info
1003+ # added by other means. But if it isn't, then we should try
1004+ # to print a little more identifying information.
1005+ if ! from_stackframe
1006+ linetable = l. uninferred. linetable
1007+ line = isempty (linetable) ? " unknown" : (lt = linetable[1 ]; string (lt. file) * ' :' * string (lt. line))
1008+ print (io, " from " , def, " starting at " , line)
1009+ end
9991010 end
10001011end
10011012
0 commit comments