From 568c7493f387699fc00b581a114b54417237c656 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Fri, 14 May 2021 01:10:02 +0200 Subject: [PATCH] Fix deprecated .data access on ; kw..., see JuliaLang/julia#39448, fixes #154. --- src/structs.jl | 12 ++++++------ src/write.jl | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/structs.jl b/src/structs.jl index 21446a0..55877d4 100644 --- a/src/structs.jl +++ b/src/structs.jl @@ -270,7 +270,7 @@ end pos += 1 return pos, T() end - c = TupleClosure(buf, pos, len, b, kw.data) + c = TupleClosure(buf, pos, len, b, values(kw)) x = StructTypes.construct(c, T) return c.pos, x @@ -381,7 +381,7 @@ mutable struct MutableClosure{T, KW} end @inline function (f::MutableClosure)(i, nm, TT; kw...) - kw2 = merge(kw.data, f.kw) + kw2 = merge(values(kw), f.kw) pos_i, y_i = read(StructType(TT), f.buf, f.pos, f.len, f.b, TT; kw2...) f.pos = pos_i return y_i @@ -446,7 +446,7 @@ end @eof b = getbyte(buf, pos) @wh - c = MutableClosure(buf, pos, len, b, kw.data) + c = MutableClosure(buf, pos, len, b, values(kw)) if StructTypes.applyfield!(c, x, key) pos = c.pos else @@ -490,7 +490,7 @@ end const DEFAULT_STRUCT_FIELD_COUNT = 32 @inline function (f::StructClosure)(i, nm, TT; kw...) - kw2 = merge(kw.data, f.kw) + kw2 = merge(values(kw), f.kw) pos_i, y_i = read(StructType(TT), f.buf, f.pos, f.len, f.b, TT; kw2...) f.pos = pos_i if i <= DEFAULT_STRUCT_FIELD_COUNT @@ -551,7 +551,7 @@ end @eof b = getbyte(buf, pos) @wh - c = StructClosure(buf, pos, len, b, values, kw.data) + c = StructClosure(buf, pos, len, b, values, Base.values(kw)) if StructTypes.applyfield(c, T, key) pos = c.pos else @@ -617,7 +617,7 @@ end end pos += 1 @eof - c = OrderedStructClosure(buf, pos, len, kw.data) + c = OrderedStructClosure(buf, pos, len, values(kw)) x = StructTypes.construct(c, T) return c.pos, x diff --git a/src/write.jl b/src/write.jl index 5e9a243..d69f77a 100644 --- a/src/write.jl +++ b/src/write.jl @@ -115,7 +115,7 @@ end else f.afterfirst = true end - kw2 = merge(kw.data, f.kw) + kw2 = merge(values(kw), f.kw) buf, pos, len = write(StringType(), buf, pos, len, nm; kw2...) @writechar ':' buf, pos, len = write(StructType(v), buf, pos, len, v; kw2...) @@ -128,7 +128,7 @@ end # generic object writing @inline function write(::Union{Struct, Mutable}, buf, pos, len, x::T; kw...) where {T} @writechar '{' - c = WriteClosure(buf, pos, len, false, kw.data) + c = WriteClosure(buf, pos, len, false, values(kw)) StructTypes.foreachfield(c, x) buf = c.buf pos = c.pos