Skip to content

Commit

Permalink
[Containers] add function barrier to getindex
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Apr 15, 2024
1 parent 11c6e89 commit c6226d2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Containers/DenseAxisArray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,15 @@ function Base.getindex(A::DenseAxisArray{T,N}, args...; kwargs...) where {T,N}
if !isempty(args)
error("Cannot index with mix of positional and keyword arguments")
end
return getindex(A, _kwargs_to_args(A; kwargs...)...)
return _getindex_inner(A, _kwargs_to_args(A; kwargs...)...)
end
return _getindex_inner(A, args...)
end

function _getindex_inner(
A::DenseAxisArray{T,N},
args::Vararg{Any,N},
) where {T,N}
new_indices = Base.to_index(A, args)
if !any(_is_range, new_indices)
return A.data[new_indices...]::T
Expand Down

0 comments on commit c6226d2

Please sign in to comment.