@@ -281,19 +281,20 @@ to_index(::MyIndexStyle, axis, arg) = ...
281
281
```
282
282
"""
283
283
@propagate_inbounds to_index (axis, arg) = to_index (IndexStyle (axis), axis, arg)
284
- to_index (axis, arg :: CartesianIndices{0} ) = arg
284
+
285
285
# Colons get converted to slices by `indices`
286
- to_index (:: IndexStyle , axis, :: Colon ) = indices (axis)
287
- @propagate_inbounds function to_index (:: IndexStyle , axis, arg:: Integer )
286
+ to_index (:: IndexLinear , axis, arg:: Colon ) = indices (axis)
287
+ to_index (:: IndexLinear , axis, arg:: CartesianIndices{0} ) = arg
288
+ @propagate_inbounds function to_index (:: IndexLinear , axis, arg:: Integer )
288
289
@boundscheck checkbounds (axis, arg)
289
290
return Int (arg)
290
291
end
291
- @propagate_inbounds function to_index (:: IndexStyle , axis, arg:: AbstractArray{Bool} )
292
+ @propagate_inbounds function to_index (:: IndexLinear , axis, arg:: AbstractArray{Bool} )
292
293
@boundscheck checkbounds (axis, arg)
293
294
return @inbounds (axis[arg])
294
295
end
295
296
@propagate_inbounds function to_index (
296
- :: IndexStyle ,
297
+ :: IndexLinear ,
297
298
axis,
298
299
arg:: AbstractArray{I} ,
299
300
) where {I<: Integer }
303
304
return arg
304
305
end
305
306
@propagate_inbounds function to_index (
306
- :: IndexStyle ,
307
+ :: IndexLinear ,
307
308
axis,
308
309
arg:: AbstractRange{I} ,
309
310
) where {I<: Integer }
312
313
end
313
314
return arg
314
315
end
315
- function to_index (S:: IndexStyle , axis, arg:: Any )
316
- throw (ArgumentError (" invalid index: IndexStyle $S does not support indices of type $(typeof (arg)) ." ))
316
+ function to_index (s, axis, arg)
317
+ throw (ArgumentError (" invalid index: IndexStyle $s does not support indices of " *
318
+ " type $(typeof (arg)) for axis of type $(typeof (axis)) ." ))
317
319
end
318
320
319
321
"""
0 commit comments