Skip to content

Commit 1c69202

Browse files
authored
Fix deprecated .data access on ; kw... (#156)
* Fix deprecated .data access on ; kw..., see JuliaLang/julia#39448, fixes #154. * Set version to 1.8.2.
1 parent 35c2661 commit 1c69202

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "JSON3"
22
uuid = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
33
authors = ["Jacob Quinn <quinn.jacobd@gmail.com>"]
4-
version = "1.8.1"
4+
version = "1.8.2"
55

66
[deps]
77
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"

src/structs.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ end
270270
pos += 1
271271
return pos, T()
272272
end
273-
c = TupleClosure(buf, pos, len, b, kw.data)
273+
c = TupleClosure(buf, pos, len, b, values(kw))
274274
x = StructTypes.construct(c, T)
275275

276276
return c.pos, x
@@ -381,7 +381,7 @@ mutable struct MutableClosure{T, KW}
381381
end
382382

383383
@inline function (f::MutableClosure)(i, nm, TT; kw...)
384-
kw2 = merge(kw.data, f.kw)
384+
kw2 = merge(values(kw), f.kw)
385385
pos_i, y_i = read(StructType(TT), f.buf, f.pos, f.len, f.b, TT; kw2...)
386386
f.pos = pos_i
387387
return y_i
@@ -446,7 +446,7 @@ end
446446
@eof
447447
b = getbyte(buf, pos)
448448
@wh
449-
c = MutableClosure(buf, pos, len, b, kw.data)
449+
c = MutableClosure(buf, pos, len, b, values(kw))
450450
if StructTypes.applyfield!(c, x, key)
451451
pos = c.pos
452452
else
@@ -490,7 +490,7 @@ end
490490
const DEFAULT_STRUCT_FIELD_COUNT = 32
491491

492492
@inline function (f::StructClosure)(i, nm, TT; kw...)
493-
kw2 = merge(kw.data, f.kw)
493+
kw2 = merge(values(kw), f.kw)
494494
pos_i, y_i = read(StructType(TT), f.buf, f.pos, f.len, f.b, TT; kw2...)
495495
f.pos = pos_i
496496
if i <= DEFAULT_STRUCT_FIELD_COUNT
@@ -551,7 +551,7 @@ end
551551
@eof
552552
b = getbyte(buf, pos)
553553
@wh
554-
c = StructClosure(buf, pos, len, b, values, kw.data)
554+
c = StructClosure(buf, pos, len, b, values, Base.values(kw))
555555
if StructTypes.applyfield(c, T, key)
556556
pos = c.pos
557557
else
@@ -617,7 +617,7 @@ end
617617
end
618618
pos += 1
619619
@eof
620-
c = OrderedStructClosure(buf, pos, len, kw.data)
620+
c = OrderedStructClosure(buf, pos, len, values(kw))
621621
x = StructTypes.construct(c, T)
622622
return c.pos, x
623623

src/write.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ end
115115
else
116116
f.afterfirst = true
117117
end
118-
kw2 = merge(kw.data, f.kw)
118+
kw2 = merge(values(kw), f.kw)
119119
buf, pos, len = write(StringType(), buf, pos, len, nm; kw2...)
120120
@writechar ':'
121121
buf, pos, len = write(StructType(v), buf, pos, len, v; kw2...)
@@ -128,7 +128,7 @@ end
128128
# generic object writing
129129
@inline function write(::Union{Struct, Mutable}, buf, pos, len, x::T; kw...) where {T}
130130
@writechar '{'
131-
c = WriteClosure(buf, pos, len, false, kw.data)
131+
c = WriteClosure(buf, pos, len, false, values(kw))
132132
StructTypes.foreachfield(c, x)
133133
buf = c.buf
134134
pos = c.pos

0 commit comments

Comments
 (0)