Skip to content

Commit 9d8fd12

Browse files
committed
Rename inds->indices
1 parent 19e1e2a commit 9d8fd12

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

base/abstractarray.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ end
2121

2222
size{T,n}(t::AbstractArray{T,n}, d) = d <= n ? size(t)[d] : 1
2323
size(x, d1::Integer, d2::Integer, dx::Integer...) = tuple(size(x, d1), size(x, d2, dx...)...)
24-
inds(A::AbstractArray, d) = 1:size(A,d)
25-
inds{T,N}(A::AbstractArray{T,N}) = ntuple(d->inds(A, d), Val{N})
24+
indices(A::AbstractArray, d) = 1:size(A,d)
25+
indices{T,N}(A::AbstractArray{T,N}) = ntuple(d->indices(A, d), Val{N})
2626
eltype{T}(::Type{AbstractArray{T}}) = T
2727
eltype{T,n}(::Type{AbstractArray{T,n}}) = T
2828
elsize{T}(::AbstractArray{T}) = sizeof(T)
@@ -106,7 +106,7 @@ function checkbounds(::Type{Bool}, inds::UnitRange, r::Range)
106106
@_propagate_inbounds_meta
107107
isempty(r) | (checkbounds(Bool, inds, first(r)) & checkbounds(Bool, inds, last(r)))
108108
end
109-
checkbounds{N}(::Type{Bool}, indx::UnitRange, I::AbstractArray{Bool,N}) = N == 1 && indx == inds(I,1)
109+
checkbounds{N}(::Type{Bool}, indx::UnitRange, I::AbstractArray{Bool,N}) = N == 1 && indx == indices(I,1)
110110
function checkbounds(::Type{Bool}, inds::UnitRange, I::AbstractArray)
111111
@_inline_meta
112112
b = true
@@ -138,13 +138,13 @@ checkbounds(A::AbstractArray, I...) = (@_inline_meta; _internal_checkbounds(A, I
138138
# The internal function is named _internal_checkbounds since there had been a
139139
# _checkbounds previously that meant something different.
140140
_internal_checkbounds(A::AbstractArray) = true
141-
_internal_checkbounds(A::AbstractArray, I::AbstractArray{Bool}) = inds(A) == inds(I) || throw_boundserror(A, I)
142-
_internal_checkbounds(A::AbstractVector, I::AbstractVector{Bool}) = inds(A) == inds(I) || throw_boundserror(A, I)
141+
_internal_checkbounds(A::AbstractArray, I::AbstractArray{Bool}) = indices(A) == indices(I) || throw_boundserror(A, I)
142+
_internal_checkbounds(A::AbstractVector, I::AbstractVector{Bool}) = indices(A) == indices(I) || throw_boundserror(A, I)
143143
_internal_checkbounds(A::AbstractArray, I::AbstractVector{Bool}) = length(A) == length(I) || throw_boundserror(A, I)
144144
function _internal_checkbounds(A::AbstractArray, I1, I...)
145145
# having I1 seems important for good codegen
146146
@_inline_meta
147-
checkbounds(Bool, inds(A), I1, I...) || throw_boundserror(A, (I1, I...))
147+
checkbounds(Bool, indices(A), I1, I...) || throw_boundserror(A, (I1, I...))
148148
end
149149

150150
# See also specializations in multidimensional
@@ -568,9 +568,9 @@ end
568568

569569
typealias RangeVecIntList{A<:AbstractVector{Int}} Union{Tuple{Vararg{Union{Range, AbstractVector{Int}}}}, AbstractVector{UnitRange{Int}}, AbstractVector{Range{Int}}, AbstractVector{A}}
570570

571-
get(A::AbstractArray, i::Integer, default) = checkbounds(Bool, inds(A), i) ? A[i] : default
571+
get(A::AbstractArray, i::Integer, default) = checkbounds(Bool, indices(A), i) ? A[i] : default
572572
get(A::AbstractArray, I::Tuple{}, default) = similar(A, typeof(default), 0)
573-
get(A::AbstractArray, I::Dims, default) = checkbounds(Bool, inds(A), I...) ? A[I...] : default
573+
get(A::AbstractArray, I::Dims, default) = checkbounds(Bool, indices(A), I...) ? A[I...] : default
574574

575575
function get!{T}(X::AbstractArray{T}, A::AbstractArray, I::Union{Range, AbstractVector{Int}}, default::T)
576576
ind = findin(I, 1:length(A))

base/deprecated.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,11 +1124,11 @@ end
11241124
@deprecate_binding ByteString String
11251125

11261126
function checkbounds(::Type{Bool}, sz::Integer, i)
1127-
depwarn("checkbounds(Bool, size(A, d), i) is deprecated, use checkbounds(Bool, inds(A, d), i).", :checkbounds)
1127+
depwarn("checkbounds(Bool, size(A, d), i) is deprecated, use checkbounds(Bool, indices(A, d), i).", :checkbounds)
11281128
checkbounds(Bool, 1:sz, i)
11291129
end
11301130
function checkbounds{N,T}(::Type{Bool}, sz::NTuple{N,Integer}, I1::T, I...)
1131-
depwarn("checkbounds(Bool, size(A), I...) is deprecated, use checkbounds(Bool, inds(A), I...).", :checkbounds)
1131+
depwarn("checkbounds(Bool, size(A), I...) is deprecated, use checkbounds(Bool, indices(A), I...).", :checkbounds)
11321132
checkbounds(Bool, map(s->1:s, sz), I1, I...)
11331133
end
11341134

base/exports.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,9 @@ export
537537
hvcat,
538538
ind2sub,
539539
indexin,
540+
indices,
540541
indmax,
541542
indmin,
542-
inds,
543543
invperm,
544544
ipermute!,
545545
ipermutedims,

base/multidimensional.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ using .IteratorsMD
193193
for N = 1:5
194194
args = [:($(Symbol(:I, d))) for d = 1:N]
195195
targs = [:($(Symbol(:I, d))::Union{Colon,Number,AbstractArray}) for d = 1:N] # prevent co-opting the CartesianIndex version
196-
exs = [:(checkbounds(Bool, inds(A, $d), $(args[d]))) for d = 1:N]
196+
exs = [:(checkbounds(Bool, indices(A, $d), $(args[d]))) for d = 1:N]
197197
cbexpr = exs[1]
198198
for d = 2:N
199199
cbexpr = :($(exs[d]) & $cbexpr)

test/abstractarray.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,9 +534,9 @@ OffsetArray{T,N}(A::AbstractArray{T,N}, offsets::NTuple{N,Int}) = OffsetArray{T,
534534

535535
Base.parent(A::OffsetArray) = A.parent
536536
Base.size(A::OffsetArray) = size(parent(A))
537-
Base.inds(A::OffsetArray, d) = (1:size(parent(A),d))+A.offsets[d]
538-
Base.eachindex(A::OffsetArray) = CartesianRange(inds(A))
539-
Base.summary(A::OffsetArray) = string(typeof(A))*" with inds "*string(inds(A))
537+
Base.indices(A::OffsetArray, d) = (1:size(parent(A),d))+A.offsets[d]
538+
Base.eachindex(A::OffsetArray) = CartesianRange(indices(A))
539+
Base.summary(A::OffsetArray) = string(typeof(A))*" with indices "*string(indices(A))
540540

541541
@inline function Base.getindex{T,N}(A::OffsetArray{T,N}, I::Vararg{Int,N})
542542
@boundscheck checkbounds(A, I...)

0 commit comments

Comments
 (0)