|
|
|
@ -945,20 +945,21 @@ STATIC void compile_del_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
|
|
|
|
|
apply_to_single_or_list(comp, pns->nodes[0], PN_exprlist, c_del_stmt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
STATIC void compile_break_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
|
|
|
|
|
if (comp->break_label == INVALID_LABEL) {
|
|
|
|
|
compile_syntax_error(comp, (mp_parse_node_t)pns, "'break' outside loop");
|
|
|
|
|
STATIC void compile_break_cont_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
|
|
|
|
|
uint16_t label;
|
|
|
|
|
const char *error_msg;
|
|
|
|
|
if (MP_PARSE_NODE_STRUCT_KIND(pns) == PN_break_stmt) {
|
|
|
|
|
label = comp->break_label;
|
|
|
|
|
error_msg = "'break' outside loop";
|
|
|
|
|
} else {
|
|
|
|
|
label = comp->continue_label;
|
|
|
|
|
error_msg = "'continue' outside loop";
|
|
|
|
|
}
|
|
|
|
|
assert(comp->cur_except_level >= comp->break_continue_except_level);
|
|
|
|
|
EMIT_ARG(unwind_jump, comp->break_label, comp->cur_except_level - comp->break_continue_except_level);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
STATIC void compile_continue_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
|
|
|
|
|
if (comp->continue_label == INVALID_LABEL) {
|
|
|
|
|
compile_syntax_error(comp, (mp_parse_node_t)pns, "'continue' outside loop");
|
|
|
|
|
if (label == INVALID_LABEL) {
|
|
|
|
|
compile_syntax_error(comp, (mp_parse_node_t)pns, error_msg);
|
|
|
|
|
}
|
|
|
|
|
assert(comp->cur_except_level >= comp->break_continue_except_level);
|
|
|
|
|
EMIT_ARG(unwind_jump, comp->continue_label, comp->cur_except_level - comp->break_continue_except_level);
|
|
|
|
|
EMIT_ARG(unwind_jump, label, comp->cur_except_level - comp->break_continue_except_level);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
STATIC void compile_return_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
|
|
|
|
|