Skip to content

Commit df066df

Browse files
authored
Merge pull request #21715 from JuliaLang/jn/static-show-typemap-entries
better static printing of typemap entries
2 parents a6f1e96 + 4bcb1bf commit df066df

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

base/boot.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,10 @@ end
370370

371371
show(io::IO, x::ANY) = ccall(:jl_static_show, Void, (Ptr{Void}, Any), io_pointer(io), x)
372372
print(io::IO, x::Char) = ccall(:jl_uv_putc, Void, (Ptr{Void}, Char), io_pointer(io), x)
373-
print(io::IO, x::String) = write(io, x)
373+
print(io::IO, x::String) = (write(io, x); nothing)
374374
print(io::IO, x::ANY) = show(io, x)
375375
print(io::IO, x::ANY, a::ANY...) = (print(io, x); print(io, a...))
376-
println(io::IO) = write(io, 0x0a) # 0x0a = '\n'
376+
println(io::IO) = (write(io, 0x0a); nothing) # 0x0a = '\n'
377377
println(io::IO, x::ANY...) = (print(io, x...); println(io))
378378

379379
show(a::ANY) = show(STDOUT, a)

src/rtutils.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -841,14 +841,16 @@ static size_t jl_static_show_x_(JL_STREAM *out, jl_value_t *v, jl_datatype_t *vt
841841
if (nb > 0 && tlen == 0) {
842842
uint8_t *data = (uint8_t*)v;
843843
n += jl_printf(out, "0x");
844-
for(int i=nb-1; i >= 0; --i)
844+
for(int i = nb - 1; i >= 0; --i)
845845
n += jl_printf(out, "%02" PRIx8, data[i]);
846846
}
847847
else {
848-
for (size_t i = 0; i < tlen; i++) {
848+
size_t i = 0;
849+
if (vt == jl_typemap_entry_type)
850+
i = 1;
851+
for (; i < tlen; i++) {
849852
if (!istuple) {
850853
n += jl_printf(out, "%s", jl_symbol_name((jl_sym_t*)jl_svecref(vt->name->names, i)));
851-
//jl_fielddesc_t f = t->fields[i];
852854
n += jl_printf(out, "=");
853855
}
854856
size_t offs = jl_field_offset(vt, i);
@@ -861,11 +863,15 @@ static size_t jl_static_show_x_(JL_STREAM *out, jl_value_t *v, jl_datatype_t *vt
861863
(jl_datatype_t*)jl_field_type(vt, i),
862864
depth);
863865
}
864-
if (istuple && tlen==1)
866+
if (istuple && tlen == 1)
865867
n += jl_printf(out, ",");
866-
else if (i != tlen-1)
868+
else if (i != tlen - 1)
867869
n += jl_printf(out, ", ");
868870
}
871+
if (vt == jl_typemap_entry_type) {
872+
n += jl_printf(out, ", next=↩︎\n ");
873+
n += jl_static_show_x(out, jl_fieldref(v, 0), depth);
874+
}
869875
}
870876
n += jl_printf(out, ")");
871877
}

0 commit comments

Comments
 (0)