py/compile: Coalesce error message for break/continue outside loop.
To reduce code size.
This commit is contained in:
parent
2679c9e116
commit
57c18fdd38
|
@ -1028,16 +1028,13 @@ STATIC void compile_del_stmt(compiler_t *comp, mp_parse_node_struct_t *pns) {
|
|||
|
||||
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";
|
||||
}
|
||||
if (label == INVALID_LABEL) {
|
||||
compile_syntax_error(comp, (mp_parse_node_t)pns, error_msg);
|
||||
compile_syntax_error(comp, (mp_parse_node_t)pns, "'break'/'continue' outside loop");
|
||||
}
|
||||
assert(comp->cur_except_level >= comp->break_continue_except_level);
|
||||
EMIT_ARG(unwind_jump, label, comp->cur_except_level - comp->break_continue_except_level);
|
||||
|
|
Loading…
Reference in New Issue