@@ -39,6 +39,7 @@ typedef enum {
3939#define EMIT_OPT_ASM_THUMB (4)
4040
4141typedef struct _compiler_t {
42+ qstr source_file ;
4243 bool is_repl ;
4344 pass_kind_t pass ;
4445 bool had_error ; // try to keep compiler clean from nlr
@@ -189,7 +190,7 @@ static int comp_next_label(compiler_t *comp) {
189190}
190191
191192static scope_t * scope_new_and_link (compiler_t * comp , scope_kind_t kind , mp_parse_node_t pn , uint emit_options ) {
192- scope_t * scope = scope_new (kind , pn , rt_get_unique_code_id (), emit_options );
193+ scope_t * scope = scope_new (kind , pn , comp -> source_file , rt_get_unique_code_id (), emit_options );
193194 scope -> parent = comp -> scope_cur ;
194195 scope -> next = NULL ;
195196 if (comp -> scope_head == NULL ) {
@@ -2509,7 +2510,9 @@ void compile_node(compiler_t *comp, mp_parse_node_t pn) {
25092510 compile_function_t f = compile_function [MP_PARSE_NODE_STRUCT_KIND (pns )];
25102511 if (f == NULL ) {
25112512 printf ("node %u cannot be compiled\n" , (uint )MP_PARSE_NODE_STRUCT_KIND (pns ));
2512- mp_parse_node_show (pn , 0 );
2513+ #if MICROPY_DEBUG_PRINTERS
2514+ mp_parse_node_print (pn , 0 );
2515+ #endif
25132516 assert (0 );
25142517 } else {
25152518 f (comp , pns );
@@ -2875,10 +2878,12 @@ void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind_t pass
28752878 mp_parse_node_t * nodes ;
28762879 int num = list_get (& pn_body , PN_suite_block_stmts , & nodes );
28772880
2881+ /*
28782882 if (comp->pass == PASS_3) {
28792883 //printf("----\n");
28802884 scope_print_info(scope);
28812885 }
2886+ */
28822887
28832888 for (int i = 0 ; i < num ; i ++ ) {
28842889 assert (MP_PARSE_NODE_IS_STRUCT (nodes [i ]));
@@ -3028,6 +3033,7 @@ void compile_scope_compute_things(compiler_t *comp, scope_t *scope) {
30283033mp_obj_t mp_compile (mp_parse_node_t pn , qstr source_file , bool is_repl ) {
30293034 compiler_t * comp = m_new (compiler_t , 1 );
30303035
3036+ comp -> source_file = source_file ;
30313037 comp -> is_repl = is_repl ;
30323038 comp -> had_error = false;
30333039
@@ -3132,7 +3138,7 @@ mp_obj_t mp_compile(mp_parse_node_t pn, qstr source_file, bool is_repl) {
31323138
31333139 default :
31343140 if (emit_bc == NULL ) {
3135- emit_bc = emit_bc_new (source_file , max_num_labels );
3141+ emit_bc = emit_bc_new (max_num_labels );
31363142 }
31373143 comp -> emit = emit_bc ;
31383144 comp -> emit_method_table = & emit_bc_method_table ;
0 commit comments