Skip to content

Commit

Permalink
Fix deprecated .data access on ; kw..., see JuliaLang/julia#39448, fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikekre committed May 13, 2021
1 parent 90ca5a2 commit 568c749
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/structs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/write.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand All @@ -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
Expand Down

0 comments on commit 568c749

Please sign in to comment.