Skip to content

Commit 425d44e

Browse files
author
Andy Ferris
committed
Fix type in insert, deleteat
1 parent f60b3d9 commit 425d44e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/deque.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ end
2323
exprs = [:(ifelse($i < index, vec[$i], ifelse($i == index, x, vec[$i-1]))) for i = 1:length(vec) + 1]
2424
return quote
2525
$(Expr(:meta, :inline))
26-
@boundscheck if (index < 1 || index > $(length(a)+1))
27-
throw(BoundsError(a, index))
26+
@boundscheck if (index < 1 || index > $(length(vec)+1))
27+
throw(BoundsError(vec, index))
2828
end
2929
@inbounds return $(Expr(:call, newtype, Expr(:tuple, exprs...)))
3030
end
@@ -53,19 +53,19 @@ end
5353
exprs = [:(ifelse($i < index, vec[$i], vec[$i+1])) for i = 1:length(vec) + 1]
5454
return quote
5555
$(Expr(:meta, :inline))
56-
@boundscheck if (index < 1 || index > $(length(a)+1))
57-
throw(BoundsError(a, index))
56+
@boundscheck if (index < 1 || index > $(length(vec)+1))
57+
throw(BoundsError(vec, index))
5858
end
5959
@inbounds return $(Expr(:call, newtype, Expr(:tuple, exprs...)))
6060
end
6161
end
6262

6363
# TODO consider prepend, append (can use vcat, but eltype might change), and
64-
# maybe splice (a bit hard to get statically sized)
64+
# maybe splice (a bit hard to get statically sized without a "static" range)
6565

6666

6767
# Immutable version of setindex!(). Seems similar in nature to the above, but
68-
# could also live in src/indexing.jl
68+
# could also be justified to live in src/indexing.jl
6969
@generated function setindex{T}(a::StaticArray{T}, x::T, index::Int)
7070
newtype = a
7171
exprs = [:(ifelse($i == index, x, a[$i])) for i = 1:length(a)]

0 commit comments

Comments
 (0)