From aad2e2576ade268561cf164887ac26cbd06b0ea0 Mon Sep 17 00:00:00 2001 From: Alexey Stukalov Date: Thu, 1 Jun 2017 05:35:01 +0200 Subject: [PATCH] show_json(CompTypeWrapper): access fields by name (#210) allows to reuse CompositeTypeWrapper for defining lower() of custom types with some fields excluded --- src/Writer.jl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Writer.jl b/src/Writer.jl index 6b12191..e0e93a8 100644 --- a/src/Writer.jl +++ b/src/Writer.jl @@ -294,9 +294,8 @@ end function show_json(io::SC, s::CS, x::CompositeTypeWrapper) begin_object(io) - fns = x.fns - for k in 1:length(fns) - show_pair(io, s, fns[k], getfield(x.wrapped, k)) + for fn in x.fns + show_pair(io, s, fn, getfield(x.wrapped, fn)) end end_object(io) end