@@ -251,6 +251,8 @@ def c() -> None:
251251 assert isinstance (fitem , FuncDef ), fitem
252252 generator_class_ir = builder .mapper .fdef_to_generator [fitem ]
253253 builder .fn_info .generator_class = GeneratorClass (generator_class_ir )
254+ if builder .fn_info .can_merge_generator_and_env_classes ():
255+ builder .fn_info .generator_class .ir .is_environment = True
254256
255257 # Functions that contain nested functions need an environment class to store variables that
256258 # are free in their nested functions. Generator functions need an environment class to
@@ -959,7 +961,6 @@ def gen_native_func_call_and_return(fdef: FuncDef) -> None:
959961 typ , src = builtin_names ["builtins.int" ]
960962 int_type_obj = builder .add (LoadAddress (typ , src , line ))
961963 is_int = builder .builder .type_is_op (impl_to_use , int_type_obj , line )
962-
963964 native_call , non_native_call = BasicBlock (), BasicBlock ()
964965 builder .add_bool_branch (is_int , native_call , non_native_call )
965966 builder .activate_block (native_call )
@@ -1092,8 +1093,7 @@ def maybe_insert_into_registry_dict(builder: IRBuilder, fitem: FuncDef) -> None:
10921093
10931094 dispatch_func_obj = builder .load_global_str (fitem .name , line )
10941095 builder .primitive_op (
1095- py_setattr_op , [dispatch_func_obj , builder .load_str ("registry" ), registry_dict ], line
1096- )
1096+ py_setattr_op , [dispatch_func_obj , builder .load_str ("registry" ), registry_dict ], line )
10971097
10981098 for singledispatch_func , types in to_register .items ():
10991099 # TODO: avoid recomputing the native IDs for all the functions every time we find a new
@@ -1107,8 +1107,7 @@ def maybe_insert_into_registry_dict(builder: IRBuilder, fitem: FuncDef) -> None:
11071107 to_insert = builder .add (load_literal )
11081108 # TODO: avoid reloading the registry here if we just created it
11091109 dispatch_func_obj = load_func (
1110- builder , singledispatch_func .name , singledispatch_func .fullname , line
1111- )
1110+ builder , singledispatch_func .name , singledispatch_func .fullname , line )
11121111 registry = load_singledispatch_registry (builder , dispatch_func_obj , line )
11131112 for typ in types :
11141113 loaded_type = load_type (builder , typ , None , line )
0 commit comments