@@ -1184,11 +1184,10 @@ def transpileStmtFor(self, node):
1184
1184
getter = v .Dereference (iterator , type = type .subtype )
1185
1185
1186
1186
self .cast (step_expr , step , t .Int )
1187
- abs_step = self .tmp (v .Call ('std::abs' , step , type = step .type ))
1188
1187
1189
1188
if type .isGenerator ():
1190
1189
cond = v .BinaryOp (v .Attribute (value , 'state' ), '!=' , - 1 )
1191
- update = v .Call (v .Attribute (value , 'next' ), abs_step )
1190
+ update = v .Call (v .Attribute (value , 'next' ), step )
1192
1191
if type .subtype != t .Void :
1193
1192
update = v .CommaSequence (v .BinaryOp (getter , '=' , update ), cond )
1194
1193
else :
@@ -1197,6 +1196,7 @@ def transpileStmtFor(self, node):
1197
1196
index = self .tmp (v .Int (0 ), force_copy = True )
1198
1197
length = self .tmp (v .Call (v .Attribute (value , 'size' ), type = t .Int ))
1199
1198
cond = v .BinaryOp (index , '<' , length )
1199
+ abs_step = self .tmp (v .Call ('std::abs' , step , type = step .type ))
1200
1200
update = v .CommaSequence (v .BinaryOp (index , '+=' , abs_step ),
1201
1201
# iterator should not cross the end of a container
1202
1202
v .TernaryOp (cond , v .CommaSequence (v .BinaryOp (iterator , '+=' , step ), v .true ), v .false ))
0 commit comments