@ -40,6 +40,8 @@
// TODO need to mangle __attr names
# define INVALID_LABEL (0xffff)
typedef enum {
// define rules with a compile function
# define DEF_RULE(rule, comp, kind, ...) PN_##rule,
@ -954,7 +956,7 @@ STATIC void compile_del_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
}
STATIC void compile_break_stmt ( compiler_t * comp , mp_parse_node_struct_t * pns ) {
if ( comp - > break_label = = 0 ) {
if ( comp - > break_label = = INVALID_LABEL ) {
compile_syntax_error ( comp , ( mp_parse_node_t ) pns , " 'break' outside loop " ) ;
}
assert ( comp - > cur_except_level > = comp - > break_continue_except_level ) ;
@ -962,7 +964,7 @@ STATIC void compile_break_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
}
STATIC void compile_continue_stmt ( compiler_t * comp , mp_parse_node_struct_t * pns ) {
if ( comp - > continue_label = = 0 ) {
if ( comp - > continue_label = = INVALID_LABEL ) {
compile_syntax_error ( comp , ( mp_parse_node_t ) pns , " 'continue' outside loop " ) ;
}
assert ( comp - > cur_except_level > = comp - > break_continue_except_level ) ;
@ -2960,7 +2962,7 @@ STATIC void check_for_doc_string(compiler_t *comp, mp_parse_node_t pn) {
STATIC void compile_scope ( compiler_t * comp , scope_t * scope , pass_kind_t pass ) {
comp - > pass = pass ;
comp - > scope_cur = scope ;
comp - > next_label = 1 ;
comp - > next_label = 0 ;
EMIT_ARG ( start_pass , pass , scope ) ;
if ( comp - > pass = = MP_PASS_SCOPE ) {
@ -3135,7 +3137,7 @@ STATIC void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) {
STATIC void compile_scope_inline_asm ( compiler_t * comp , scope_t * scope , pass_kind_t pass ) {
comp - > pass = pass ;
comp - > scope_cur = scope ;
comp - > next_label = 1 ;
comp - > next_label = 0 ;
if ( scope - > kind ! = SCOPE_FUNCTION ) {
compile_syntax_error ( comp , MP_PARSE_NODE_NULL , " inline assembler must be a function " ) ;
@ -3381,6 +3383,8 @@ mp_raw_code_t *mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_f
comp - > source_file = source_file ;
comp - > is_repl = is_repl ;
comp - > break_label = INVALID_LABEL ;
comp - > continue_label = INVALID_LABEL ;
// create the module scope
scope_t * module_scope = scope_new_and_link ( comp , SCOPE_MODULE , parse_tree - > root , emit_opt ) ;