@@ -176,15 +176,15 @@ end
176176function replace_enumerate! (q, prepreamble)
177177 looprange = q. args[1 ]
178178 if Meta. isexpr (looprange, :block )
179- for i in 1 : length (looprange. args)
179+ for i = 1 : length (looprange. args)
180180 replace_single_enumerate! (q, prepreamble, i)
181181 end
182182 else
183183 replace_single_enumerate! (q, prepreamble)
184184 end
185185 return q
186186end
187- function replace_single_enumerate! (q, prepreamble, i= nothing )
187+ function replace_single_enumerate! (q, prepreamble, i = nothing )
188188 if isnothing (i) # not nest loop
189189 looprange, body = q. args[1 ], q. args[2 ]
190190 else # nest loop
@@ -203,7 +203,7 @@ function replace_single_enumerate!(q, prepreamble, i=nothing)
203203 if Meta. isexpr (itersyms, :tuple , 2 )
204204 indsym, varsym = itersyms. args[1 ]:: Symbol , itersyms. args[2 ]:: Symbol
205205 _replace_looprange! (q, i, indsym, iter)
206- pushfirst! (body. args, :($ varsym = $ iter[$ indsym + firstindex ($ iter) - 1 ]))
206+ pushfirst! (body. args, :($ varsym = $ iter[$ indsym+ firstindex ($ iter)- 1 ]))
207207 elseif Meta. isexpr (itersyms, :tuple , 1 ) # like `for (i,) in enumerate(...)`
208208 indsym = itersyms. args[1 ]:: Symbol
209209 _replace_looprange! (q, i, indsym, iter)
@@ -216,8 +216,10 @@ function replace_single_enumerate!(q, prepreamble, i=nothing)
216216 end
217217 return q
218218end
219- _replace_looprange! (q, :: Nothing , indsym, iter) = q. args[1 ] = :($ indsym = Base. OneTo (length ($ iter)))
220- _replace_looprange! (q, i:: Int , indsym, iter) = q. args[1 ]. args[i] = :($ indsym = Base. OneTo (length ($ iter)))
219+ _replace_looprange! (q, :: Nothing , indsym, iter) =
220+ q. args[1 ] = :($ indsym = Base. OneTo (length ($ iter)))
221+ _replace_looprange! (q, i:: Int , indsym, iter) =
222+ q. args[1 ]. args[i] = :($ indsym = Base. OneTo (length ($ iter)))
221223
222224function turbo_macro (mod, src, q, args... )
223225 q = macroexpand (mod, q)
0 commit comments