Skip to content

Commit ee181ab

Browse files
committed
Fixed KeepIndex for older Julias?
1 parent e883efe commit ee181ab

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/componentindex.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ Base.getindex(ax::AbstractAxis, i::KeepIndex{Idx}) where {Idx} = _getindex_keep(
2525
_getindex_keep(ax::AbstractAxis, ::Colon) = ComponentIndex(:, ax)
2626
function _getindex_keep(ax::AbstractAxis, idx::AbstractRange)
2727
idx_map = indexmap(ax)
28-
keeps = NamedTuple([s=>x for (s,x) in pairs(idx_map) if first(viewindex(x)) in idx && last(viewindex(x)) in idx])
28+
keeps = (s=>x for (s,x) in pairs(idx_map) if first(viewindex(x)) in idx && last(viewindex(x)) in idx)
29+
keeps = NamedTuple{Tuple(first.(keeps))}(Tuple(last.(keeps)))
2930
new_ax = reindex(Axis(keeps), -first(idx)+1)
3031
return ComponentIndex(idx, new_ax)
3132
end

0 commit comments

Comments
 (0)