868
868
# -----------------------------------------
869
869
870
870
index_to_dict (i:: Integer ) = Dict (:type => " integer" , :value => i)
871
- index_to_dict (r:: UnitRange ) = Dict (:type => " unitrange" , :first => first (r), :last => last (r))
871
+ index_to_dict (r:: UnitRange ) = Dict (:type => " unitrange" , :start => r. start, :stop => r. stop)
872
+ index_to_dict (r:: StepRange ) = Dict (:type => " steprange" , :start => r. start, :stop => r. stop, :step => r. step)
872
873
index_to_dict (:: Colon ) = Dict (:type => " colon" )
873
874
index_to_dict (s:: ConcretizedSlice{T,Base.OneTo{I}} ) where {T,I} = Dict (:type => " concretized_slice" , :oneto => s. range. stop)
874
875
index_to_dict (:: ConcretizedSlice{T,R} ) where {T,R} = error (" ConcretizedSlice with range type $(R) not supported" )
@@ -880,7 +881,9 @@ function dict_to_index(dict)
880
881
if dict[:type ] == " integer"
881
882
return dict[:value ]
882
883
elseif dict[:type ] == " unitrange"
883
- return dict[:first ]: dict[:last ]
884
+ return dict[:start ]: dict[:stop ]
885
+ elseif dict[:type ] == " steprange"
886
+ return dict[:start ]: dict[:step ]: dict[:stop ]
884
887
elseif dict[:type ] == " colon"
885
888
return Colon ()
886
889
elseif dict[:type ] == " concretized_slice"
@@ -892,7 +895,6 @@ function dict_to_index(dict)
892
895
end
893
896
end
894
897
895
-
896
898
optic_to_dict (:: typeof (identity)) = Dict (:type => " identity" )
897
899
optic_to_dict (:: PropertyLens{sym} ) where {sym} = Dict (:type => " property" , :field => String (sym))
898
900
optic_to_dict (i:: IndexLens ) = Dict (:type => " index" , :indices => index_to_dict (i. indices))
0 commit comments