@@ -3090,7 +3090,10 @@ STATIC void scope_compute_things(scope_t *scope) {
30903090 }
30913091}
30923092
3093- mp_obj_t mp_compile (mp_parse_tree_t * parse_tree , qstr source_file , uint emit_opt , bool is_repl ) {
3093+ #if !MICROPY_PERSISTENT_CODE_SAVE
3094+ STATIC
3095+ #endif
3096+ mp_raw_code_t * mp_compile_to_raw_code (mp_parse_tree_t * parse_tree , qstr source_file , uint emit_opt , bool is_repl ) {
30943097 // put compiler state on the stack, it's relatively small
30953098 compiler_t comp_state = {0 };
30963099 compiler_t * comp = & comp_state ;
@@ -3263,7 +3266,12 @@ mp_obj_t mp_compile(mp_parse_tree_t *parse_tree, qstr source_file, uint emit_opt
32633266 if (comp -> compile_error != MP_OBJ_NULL ) {
32643267 nlr_raise (comp -> compile_error );
32653268 } else {
3266- // return function that executes the outer module
3267- return mp_make_function_from_raw_code (outer_raw_code , MP_OBJ_NULL , MP_OBJ_NULL );
3269+ return outer_raw_code ;
32683270 }
32693271}
3272+
3273+ mp_obj_t mp_compile (mp_parse_tree_t * parse_tree , qstr source_file , uint emit_opt , bool is_repl ) {
3274+ mp_raw_code_t * rc = mp_compile_to_raw_code (parse_tree , source_file , emit_opt , is_repl );
3275+ // return function that executes the outer module
3276+ return mp_make_function_from_raw_code (rc , MP_OBJ_NULL , MP_OBJ_NULL );
3277+ }
0 commit comments