Skip to content

Commit 0d2ef74

Browse files
authored
Use deprecated bindings from Base for deprecations (#378)
1 parent a1e9df5 commit 0d2ef74

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/DataStructures.jl

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,21 @@ module DataStructures
143143
PriorityQueue(o, zip(ks,vs))
144144
end
145145

146-
@deprecate find(x::Union{SortedDict,SortedSet}, k) findkey(x, k)
147-
@deprecate endof(x::OrderedSet) lastindex(x)
148-
for T in [:IntSet, :Deque, :CircularDeque]
149-
@eval @deprecate shift!(x::$T) popfirst!(x)
146+
if isdefined(Base, :find)
147+
import Base: find
148+
@deprecate find(x::Union{SortedDict,SortedSet}, k) findkey(x, k)
150149
end
151-
for T in [:Deque, :CircularDeque, :CircularBuffer]
152-
@eval @deprecate unshift!(d::$T, x) pushfirst!(d, x)
150+
if isdefined(Base, :endof) && isdefined(Base, :lastindex)
151+
import Base: endof
152+
@deprecate endof(x::OrderedSet) lastindex(x)
153+
end
154+
if isdefined(Base, :shift!) && isdefined(Base, :popfirst!)
155+
import Base: shift!, unshift!
156+
for T in [:IntSet, :Deque, :CircularDeque]
157+
@eval @deprecate shift!(x::$T) popfirst!(x)
158+
end
159+
for T in [:Deque, :CircularDeque, :CircularBuffer]
160+
@eval @deprecate unshift!(d::$T, x) pushfirst!(d, x)
161+
end
153162
end
154163
end

0 commit comments

Comments
 (0)