Skip to content

Commit c0d59c1

Browse files
committed
Small reorganization
1 parent 48d1d44 commit c0d59c1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/blockindices.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ struct BlockSlice{BB,T<:Integer,INDS<:AbstractUnitRange{T}} <: AbstractUnitRange
270270
end
271271

272272
Block(bs::BlockSlice{<:Block}) = bs.block
273+
Block(bs::BlockSlice{<:BlockIndexRange}) = Block(bs.block)
273274

274275

275276
for f in (:axes, :unsafe_indices, :axes1, :first, :last, :size, :length,
@@ -289,8 +290,6 @@ _indices(B) = B
289290
# Avoid creating a SubArray wrapper in certain non-allocating cases
290291
@propagate_inbounds view(C::CartesianIndices{N}, bs::Vararg{BlockSlice,N}) where {N} = view(C, map(x->x.indices, bs)...)
291292

292-
Block(bs::BlockSlice{<:BlockIndexRange}) = Block(bs.block)
293-
294293
"""
295294
NoncontiguousBlockSlice(blocks, indices)
296295
@@ -309,6 +308,7 @@ struct NoncontiguousBlockSlice{BB,T,INDS<:AbstractVector{T}} <: AbstractVector{T
309308
end
310309

311310
Block(bs::NoncontiguousBlockSlice{<:Block}) = bs.block
311+
Block(bs::NoncontiguousBlockSlice{<:BlockIndexRange}) = Block(bs.block)
312312

313313
for f in (:axes, :unsafe_indices, :axes1, :first, :last, :size, :length,
314314
:unsafe_length, :start)
@@ -330,8 +330,6 @@ struct BlockRange{N,R<:NTuple{N,AbstractUnitRange{<:Integer}}} <: AbstractArray{
330330
BlockRange{N,R}(inds::R) where {N,R} = new{N,R}(inds)
331331
end
332332

333-
Block(bs::NoncontiguousBlockSlice{<:BlockIndexRange}) = Block(bs.block)
334-
335333
# The following is adapted from Julia v0.7 base/multidimensional.jl
336334
# definition of CartesianRange
337335

0 commit comments

Comments
 (0)