@@ -555,8 +555,11 @@ STATIC void emit_native_set_native_type(emit_t *emit, mp_uint_t op, mp_uint_t ar
555555 }
556556}
557557
558+ STATIC void emit_pre_pop_reg (emit_t * emit , vtype_kind_t * vtype , int reg_dest );
558559STATIC void emit_post_push_reg (emit_t * emit , vtype_kind_t vtype , int reg );
560+ STATIC void emit_native_load_fast (emit_t * emit , qstr qst , mp_uint_t local_num );
559561STATIC void emit_native_store_fast (emit_t * emit , qstr qst , mp_uint_t local_num );
562+
560563STATIC void emit_native_start_pass (emit_t * emit , pass_kind_t pass , scope_t * scope ) {
561564 DEBUG_printf ("start_pass(pass=%u, scope=%p)\n" , pass , scope );
562565
@@ -684,6 +687,11 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop
684687 for (int i = 0 ; i < scope -> id_info_len ; i ++ ) {
685688 id_info_t * id = & scope -> id_info [i ];
686689 if (id -> kind == ID_INFO_KIND_CELL ) {
690+ if (emit -> local_vtype [id -> local_num ] != VTYPE_UNBOUND ) {
691+ emit_native_load_fast (emit , id -> qst , id -> local_num );
692+ vtype_kind_t vtype ;
693+ emit_pre_pop_reg (emit , & vtype , REG_ARG_1 );
694+ }
687695 ASM_CALL_IND (emit -> as , mp_fun_table [MP_F_NEW_CELL ], MP_F_NEW_CELL );
688696 emit_post_push_reg (emit , VTYPE_PYOBJ , REG_RET );
689697 emit_native_store_fast (emit , id -> qst , id -> local_num );
0 commit comments