Skip to content

Commit ad18ec2

Browse files
authored
separate the function Base._iterate into two functions (#59379)
1 parent bb36851 commit ad18ec2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

base/abstractarray.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,13 +1238,13 @@ oneunit(x::AbstractMatrix{T}) where {T} = _one(oneunit(T), x)
12381238
iterate_starting_state(A) = iterate_starting_state(A, IndexStyle(A))
12391239
iterate_starting_state(A, ::IndexLinear) = firstindex(A)
12401240
iterate_starting_state(A, ::IndexStyle) = (eachindex(A),)
1241-
@inline iterate(A::AbstractArray, state = iterate_starting_state(A)) = _iterate(A, state)
1242-
@inline function _iterate(A::AbstractArray, state::Tuple)
1241+
@inline iterate(A::AbstractArray, state = iterate_starting_state(A)) = _iterate_abstractarray(A, state)
1242+
@inline function _iterate_abstractarray(A::AbstractArray, state::Tuple)
12431243
y = iterate(state...)
12441244
y === nothing && return nothing
12451245
A[y[1]], (state[1], tail(y)...)
12461246
end
1247-
@inline function _iterate(A::AbstractArray, state::Integer)
1247+
@inline function _iterate_abstractarray(A::AbstractArray, state::Integer)
12481248
checkbounds(Bool, A, state) || return nothing
12491249
A[state], state + one(state)
12501250
end

base/dict.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -698,11 +698,11 @@ function skip_deleted_floor!(h::Dict)
698698
idx
699699
end
700700

701-
@propagate_inbounds _iterate(t::Dict{K,V}, i) where {K,V} = i == 0 ? nothing : (Pair{K,V}(t.keys[i],t.vals[i]), i == typemax(Int) ? 0 : i+1)
701+
@propagate_inbounds _iterate_dict(t::Dict{K,V}, i) where {K,V} = i == 0 ? nothing : (Pair{K,V}(t.keys[i],t.vals[i]), i == typemax(Int) ? 0 : i+1)
702702
@propagate_inbounds function iterate(t::Dict)
703-
_iterate(t, skip_deleted(t, t.idxfloor))
703+
_iterate_dict(t, skip_deleted(t, t.idxfloor))
704704
end
705-
@propagate_inbounds iterate(t::Dict, i) = _iterate(t, skip_deleted(t, i))
705+
@propagate_inbounds iterate(t::Dict, i) = _iterate_dict(t, skip_deleted(t, i))
706706

707707
isempty(t::Dict) = (t.count == 0)
708708
length(t::Dict) = t.count

0 commit comments

Comments
 (0)