mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
py: Add "default" to switches to allow better code flow analysis.
This helps compiler produce smaller code. Saves 124 bytes on stmhal and bare-arm.
This commit is contained in:
@@ -110,6 +110,7 @@ mp_obj_t mp_make_function_from_raw_code(mp_raw_code_t *rc, mp_obj_t def_args, mp
|
||||
mp_obj_t fun;
|
||||
switch (rc->kind) {
|
||||
case MP_CODE_BYTECODE:
|
||||
no_other_choice:
|
||||
fun = mp_obj_new_fun_bc(rc->scope_flags, rc->n_pos_args, rc->n_kwonly_args, def_args, def_kw_args, rc->u_byte.code);
|
||||
break;
|
||||
#if MICROPY_EMIT_NATIVE
|
||||
@@ -128,7 +129,7 @@ mp_obj_t mp_make_function_from_raw_code(mp_raw_code_t *rc, mp_obj_t def_args, mp
|
||||
default:
|
||||
// raw code was never set (this should not happen)
|
||||
assert(0);
|
||||
return mp_const_none;
|
||||
goto no_other_choice; // to help flow control analysis
|
||||
}
|
||||
|
||||
// check for generator functions and if so wrap in generator object
|
||||
|
||||
Reference in New Issue
Block a user