@@ -2490,20 +2490,16 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar
24902490 // this is to handle special super() call
24912491 if (MP_PARSE_NODE_IS_NULL (pn_arglist ) && comp -> func_arg_is_super && comp -> scope_cur -> kind == SCOPE_FUNCTION ) {
24922492 EMIT_ARG (load_id , MP_QSTR___class__ );
2493- // get first argument to function
2494- bool found = false;
2493+ // look for first argument to function (assumes it's "self")
24952494 for (int i = 0 ; i < comp -> scope_cur -> id_info_len ; i ++ ) {
24962495 if (comp -> scope_cur -> id_info [i ].flags & ID_FLAG_IS_PARAM ) {
2496+ // first argument found; load it and call super
24972497 EMIT_ARG (load_fast , MP_QSTR_ , comp -> scope_cur -> id_info [i ].flags , comp -> scope_cur -> id_info [i ].local_num );
2498- found = true ;
2499- break ;
2498+ EMIT_ARG ( call_function , 2 , 0 , 0 ) ;
2499+ return ;
25002500 }
25012501 }
2502- if (!found ) {
2503- printf ("TypeError: super() call cannot find self\n" );
2504- return ;
2505- }
2506- EMIT_ARG (call_function , 2 , 0 , 0 );
2502+ compile_syntax_error (comp , MP_PARSE_NODE_NULL , "super() call cannot find self" ); // really a TypeError
25072503 return ;
25082504 }
25092505#endif
@@ -2972,8 +2968,8 @@ STATIC void compile_node(compiler_t *comp, mp_parse_node_t pn) {
29722968 } else {
29732969 compile_function_t f = compile_function [MP_PARSE_NODE_STRUCT_KIND (pns )];
29742970 if (f == NULL ) {
2975- printf ("node %u cannot be compiled\n" , (uint )MP_PARSE_NODE_STRUCT_KIND (pns ));
29762971#if MICROPY_DEBUG_PRINTERS
2972+ printf ("node %u cannot be compiled\n" , (uint )MP_PARSE_NODE_STRUCT_KIND (pns ));
29772973 mp_parse_node_print (pn , 0 );
29782974#endif
29792975 compile_syntax_error (comp , pn , "internal compiler error" );
@@ -3377,7 +3373,7 @@ STATIC void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind
33773373 comp -> next_label = 1 ;
33783374
33793375 if (scope -> kind != SCOPE_FUNCTION ) {
3380- printf ( "Error: inline assembler must be a function\n " );
3376+ compile_syntax_error ( comp , MP_PARSE_NODE_NULL , " inline assembler must be a function" );
33813377 return ;
33823378 }
33833379
0 commit comments