|
1 | 1 | # A lightly-modified version of the same function in Base |
2 | 2 | # Highlights argument types with color specified by highlighter(typ) |
3 | | -function show_tuple_as_call(@nospecialize(highlighter), io::IO, name::Symbol, @nospecialize(sig::Type), demangle=false, kwargs=nothing) |
| 3 | +function show_tuple_as_call(@nospecialize(highlighter), io::IO, name::Symbol, @nospecialize(sig::Type), demangle=false #=, kwargs=nothing =#) |
4 | 4 | if sig === Tuple |
5 | 5 | print(io, demangle ? Base.demangle_function_name(name) : name, "(...)") |
6 | 6 | return |
@@ -34,16 +34,16 @@ function show_tuple_as_call(@nospecialize(highlighter), io::IO, name::Symbol, @n |
34 | 34 | first = false |
35 | 35 | printstyled(env_io, "::", sig[i], color=highlighter(sig[i])) |
36 | 36 | end |
37 | | - if kwargs !== nothing |
38 | | - print(io, "; ") |
39 | | - first = true |
40 | | - for (k, t) in kwargs |
41 | | - first || print(io, ", ") |
42 | | - first = false |
43 | | - print(io, k, "::") |
44 | | - show(io, t) |
45 | | - end |
46 | | - end |
| 37 | + # if kwargs !== nothing |
| 38 | + # print(io, "; ") |
| 39 | + # first = true |
| 40 | + # for (k, t) in kwargs |
| 41 | + # first || print(io, ", ") |
| 42 | + # first = false |
| 43 | + # print(io, k, "::") |
| 44 | + # show(io, t) |
| 45 | + # end |
| 46 | + # end |
47 | 47 | print(io, ")") |
48 | 48 | Base.show_method_params(io, tv) |
49 | 49 | nothing |
@@ -89,22 +89,23 @@ nextnode(mi, edge) = edge |
89 | 89 | instance(sfs::Vector{StackTraces.StackFrame}) = sfs[end].linfo |
90 | 90 | method(sfs::Vector{StackTraces.StackFrame}) = method(instance(sfs)) |
91 | 91 |
|
92 | | -instance(ipframes::Vector{IPFrames}) = instance(ipframes[1].sfs) |
| 92 | +instance(ipframes::Vector{IPFrames}) = isempty(ipframes) ? nothing : instance(ipframes[1].sfs) |
93 | 93 | backedges(ipframes::Vector{IPFrames}) = (ret = ipframes[2:end]; isempty(ret) ? () : (ret,)) |
94 | 94 |
|
95 | 95 | function callstring(io, mi) |
96 | 96 | show_tuple_as_call(nonconcrete_red, IOContext(io, :color=>true), method(mi).name, specTypes(mi)) |
97 | 97 | return String(take!(io)) |
98 | 98 | end |
99 | 99 | function callstring(io, sfs::Vector{StackTraces.StackFrame}) |
| 100 | + isempty(sfs) && return "" |
100 | 101 | for i = 1:length(sfs)-1 |
101 | 102 | sf = sfs[i] |
102 | 103 | print(io, sf.func, " at ", sf.file, ':', sf.line, " => ") |
103 | 104 | end |
104 | 105 | sf = sfs[end] |
105 | 106 | return callstring(io, instance(sfs)) * string(" at ", sf.file, ':', sf.line) |
106 | 107 | end |
107 | | -callstring(io, ipframes::Vector{IPFrames}) = callstring(io, ipframes[1].sfs) |
| 108 | +callstring(io, ipframes::Vector{IPFrames}) = isempty(ipframes) ? "" : callstring(io, ipframes[1].sfs) |
108 | 109 |
|
109 | 110 | struct Data{T} |
110 | 111 | callstr::String |
|
0 commit comments