Skip to content

Commit a3da162

Browse files
committed
fix ci for 1.0
1 parent 04dbfc8 commit a3da162

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/ngg/compact.jl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,28 @@ function _assign_id(pool::AbstractVector, flag::UInt)
5555
end
5656
end
5757

58+
@static if VERSION < v"1.1"
59+
function _get!(default::Function, d::Base.IdDict{K,V}, @nospecialize(key)) where {K,V}
60+
val = get(d, key, Base.secret_table_token)
61+
if val === Base.secret_table_token
62+
val = default()
63+
if !isa(val, V)
64+
val = convert(V, val)::V
65+
end
66+
setindex!(d, val, key)
67+
return val
68+
else
69+
return val::V
70+
end
71+
end
72+
end
73+
74+
_get!(f, d, key) = get!(f, d, key)
75+
5876
function _get_id!(pool, index, val, flag)
5977
lock(_lock)
6078
try
61-
get!(index, val) do
79+
_get!(index, val) do
6280
id = _assign_id(pool, flag)
6381
push!(pool, val)
6482
index[val] = id

0 commit comments

Comments
 (0)