@@ -545,7 +545,7 @@ def translate_sum_call(builder: IRBuilder, expr: CallExpr, callee: RefExpr) -> V
545545 acc_rtype = int_rprimitive
546546 elif is_object_rprimitive (item_rtype ) and is_int_rprimitive (start_rtype ):
547547 acc_rtype = object_rprimitive
548-
548+
549549 else :
550550 # escape hatch, maybe figure out a better way to handle this whole block
551551 # seeking ideas in review
@@ -555,17 +555,16 @@ def translate_sum_call(builder: IRBuilder, expr: CallExpr, callee: RefExpr) -> V
555555 builder .assign (retval , builder .coerce (builder .accept (start_expr ), acc_rtype , - 1 ), - 1 )
556556
557557 if isinstance (arg , GeneratorExpr ):
558+
558559 def gen_inner_stmts () -> None :
559560 call_expr = builder .accept (arg .left_expr )
560561 builder .assign (retval , builder .binary_op (retval , call_expr , "+" , - 1 ), - 1 )
561562
562- loop_params = list (
563- zip (arg .indices , arg .sequences , arg .condlists , arg .is_async )
564- )
563+ loop_params = list (zip (arg .indices , arg .sequences , arg .condlists , arg .is_async ))
565564 comprehension_helper (builder , loop_params , gen_inner_stmts , arg .line )
566565
567566 return retval
568-
567+
569568 else :
570569 index_name = "__mypyc_sum_item__"
571570
@@ -577,15 +576,7 @@ def body_insts() -> None:
577576 index = _create_iterable_lexpr (index_name , index_type )
578577 index_reg = builder .add_local_reg (index .node , builder .type_to_rtype (index_type ))
579578
580- for_loop_helper (
581- builder ,
582- index ,
583- arg ,
584- body_insts ,
585- None ,
586- is_async = False ,
587- line = expr .line ,
588- )
579+ for_loop_helper (builder , index , arg , body_insts , None , is_async = False , line = expr .line )
589580 return retval
590581
591582
0 commit comments