aboutsummaryrefslogtreecommitdiff
path: root/py/emitglue.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-12-21 11:52:05 +1100
committerDamien George <damien.p.george@gmail.com>2016-12-21 11:52:05 +1100
commit46a6592f9ac072386ee2a106c8928d2a1d955cbb (patch)
tree9d16a7a21fa644004e2821848827e677f62ec992 /py/emitglue.c
parente4af71212550d950269f6991be187f41dcf64eee (diff)
py/emitglue: Refactor to remove assert(0), to improve coverage.
Diffstat (limited to 'py/emitglue.c')
-rw-r--r--py/emitglue.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/py/emitglue.c b/py/emitglue.c
index 795c738d3..fb7a54926 100644
--- a/py/emitglue.c
+++ b/py/emitglue.c
@@ -126,10 +126,6 @@ mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, mp_obj_t def_ar
// make the function, depending on the raw code kind
mp_obj_t fun;
switch (rc->kind) {
- case MP_CODE_BYTECODE:
- no_other_choice:
- fun = mp_obj_new_fun_bc(def_args, def_kw_args, rc->data.u_byte.bytecode, rc->data.u_byte.const_table);
- break;
#if MICROPY_EMIT_NATIVE
case MP_CODE_NATIVE_PY:
fun = mp_obj_new_fun_native(def_args, def_kw_args, rc->data.u_native.fun_data, rc->data.u_native.const_table);
@@ -144,9 +140,10 @@ mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, mp_obj_t def_ar
break;
#endif
default:
- // raw code was never set (this should not happen)
- assert(0);
- goto no_other_choice; // to help flow control analysis
+ // rc->kind should always be set and BYTECODE is the only remaining case
+ assert(rc->kind == MP_CODE_BYTECODE);
+ fun = mp_obj_new_fun_bc(def_args, def_kw_args, rc->data.u_byte.bytecode, rc->data.u_byte.const_table);
+ break;
}
// check for generator functions and if so wrap in generator object