Skip to content

Commit f51f22d

Browse files
committed
py/emitnative: Remove assert(0)'s or replace with mp_not_implemented.
1 parent 86e9423 commit f51f22d

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

py/emitnative.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop
389389
ASM_MOV_REG_TO_LOCAL(emit->as, REG_ARG_4, i - REG_LOCAL_NUM);
390390
} else {
391391
// TODO not implemented
392-
assert(0);
392+
mp_not_implemented("more than 4 viper args");
393393
}
394394
}
395395
#endif
@@ -977,19 +977,19 @@ STATIC void emit_native_load_const_tok(emit_t *emit, mp_token_kind_t tok) {
977977
case MP_TOKEN_KW_NONE: vtype = VTYPE_PTR_NONE; val = 0; break;
978978
case MP_TOKEN_KW_FALSE: vtype = VTYPE_BOOL; val = 0; break;
979979
case MP_TOKEN_KW_TRUE: vtype = VTYPE_BOOL; val = 1; break;
980-
no_other_choice1:
981-
case MP_TOKEN_ELLIPSIS: vtype = VTYPE_PYOBJ; val = (mp_uint_t)&mp_const_ellipsis_obj; break;
982-
default: assert(0); goto no_other_choice1; // to help flow control analysis
980+
default:
981+
assert(tok == MP_TOKEN_ELLIPSIS);
982+
vtype = VTYPE_PYOBJ; val = (mp_uint_t)&mp_const_ellipsis_obj; break;
983983
}
984984
} else {
985985
vtype = VTYPE_PYOBJ;
986986
switch (tok) {
987987
case MP_TOKEN_KW_NONE: val = (mp_uint_t)mp_const_none; break;
988988
case MP_TOKEN_KW_FALSE: val = (mp_uint_t)mp_const_false; break;
989989
case MP_TOKEN_KW_TRUE: val = (mp_uint_t)mp_const_true; break;
990-
no_other_choice2:
991-
case MP_TOKEN_ELLIPSIS: val = (mp_uint_t)&mp_const_ellipsis_obj; break;
992-
default: assert(0); goto no_other_choice2; // to help flow control analysis
990+
default:
991+
assert(tok == MP_TOKEN_ELLIPSIS);
992+
val = (mp_uint_t)&mp_const_ellipsis_obj; break;
993993
}
994994
}
995995
emit_post_push_imm(emit, vtype, val);
@@ -2271,12 +2271,12 @@ STATIC void emit_native_raise_varargs(emit_t *emit, mp_uint_t n_args) {
22712271
STATIC void emit_native_yield_value(emit_t *emit) {
22722272
// not supported (for now)
22732273
(void)emit;
2274-
assert(0);
2274+
mp_not_implemented("native yield");
22752275
}
22762276
STATIC void emit_native_yield_from(emit_t *emit) {
22772277
// not supported (for now)
22782278
(void)emit;
2279-
assert(0);
2279+
mp_not_implemented("native yield from");
22802280
}
22812281

22822282
STATIC void emit_native_start_except_handler(emit_t *emit) {

0 commit comments

Comments
 (0)