@@ -541,7 +541,7 @@ def translate_sum_call(builder: IRBuilder, expr: CallExpr, callee: RefExpr) -> V
541
541
acc_rtype = int_rprimitive
542
542
elif is_object_rprimitive (item_rtype ) and is_int_rprimitive (start_rtype ):
543
543
acc_rtype = object_rprimitive
544
-
544
+
545
545
else :
546
546
# escape hatch, maybe figure out a better way to handle this whole block
547
547
# seeking ideas in review
@@ -551,17 +551,16 @@ def translate_sum_call(builder: IRBuilder, expr: CallExpr, callee: RefExpr) -> V
551
551
builder .assign (retval , builder .coerce (builder .accept (start_expr ), acc_rtype , - 1 ), - 1 )
552
552
553
553
if isinstance (arg , GeneratorExpr ):
554
+
554
555
def gen_inner_stmts () -> None :
555
556
call_expr = builder .accept (arg .left_expr )
556
557
builder .assign (retval , builder .binary_op (retval , call_expr , "+" , - 1 ), - 1 )
557
558
558
- loop_params = list (
559
- zip (arg .indices , arg .sequences , arg .condlists , arg .is_async )
560
- )
559
+ loop_params = list (zip (arg .indices , arg .sequences , arg .condlists , arg .is_async ))
561
560
comprehension_helper (builder , loop_params , gen_inner_stmts , arg .line )
562
561
563
562
return retval
564
-
563
+
565
564
else :
566
565
index_name = "__mypyc_sum_item__"
567
566
@@ -573,15 +572,7 @@ def body_insts() -> None:
573
572
index = _create_iterable_lexpr (index_name , index_type )
574
573
index_reg = builder .add_local_reg (index .node , builder .type_to_rtype (index_type ))
575
574
576
- for_loop_helper (
577
- builder ,
578
- index ,
579
- arg ,
580
- body_insts ,
581
- None ,
582
- is_async = False ,
583
- line = expr .line ,
584
- )
575
+ for_loop_helper (builder , index , arg , body_insts , None , is_async = False , line = expr .line )
585
576
return retval
586
577
587
578
0 commit comments