Rename mp_type_unary_op -> mp_type_get_unary_op_slot
This commit is contained in:
parent
ec53a674cf
commit
46b5ed33ed
6
py/obj.c
6
py/obj.c
|
@ -201,7 +201,7 @@ bool PLACE_IN_ITCM(mp_obj_is_true)(mp_obj_t arg) {
|
|||
}
|
||||
} else {
|
||||
const mp_obj_type_t *type = mp_obj_get_type(arg);
|
||||
mp_unary_op_fun_t unary_op = mp_type_unary_op(type);
|
||||
mp_unary_op_fun_t unary_op = mp_type_get_unary_op_slot(type);
|
||||
if (unary_op) {
|
||||
mp_obj_t result = unary_op(MP_UNARY_OP_BOOL, arg);
|
||||
if (result != MP_OBJ_NULL) {
|
||||
|
@ -564,7 +564,7 @@ mp_obj_t mp_obj_len_maybe(mp_obj_t o_in) {
|
|||
return MP_OBJ_NEW_SMALL_INT(l);
|
||||
} else {
|
||||
const mp_obj_type_t *type = mp_obj_get_type(o_in);
|
||||
mp_unary_op_fun_t unary_op = mp_type_unary_op(type);
|
||||
mp_unary_op_fun_t unary_op = mp_type_get_unary_op_slot(type);
|
||||
if (unary_op != NULL) {
|
||||
return unary_op(MP_UNARY_OP_LEN, o_in);
|
||||
} else {
|
||||
|
@ -685,7 +685,7 @@ mp_call_fun_t mp_type_get_call_slot(const mp_obj_type_t *type) {
|
|||
return type->ext[0].call;
|
||||
}
|
||||
|
||||
mp_unary_op_fun_t mp_type_unary_op(const mp_obj_type_t *type) {
|
||||
mp_unary_op_fun_t mp_type_get_unary_op_slot(const mp_obj_type_t *type) {
|
||||
if (!(type->flags & MP_TYPE_FLAG_EXTENDED)) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
2
py/obj.h
2
py/obj.h
|
@ -663,7 +663,7 @@ struct _mp_obj_full_type_t {
|
|||
#define MP_TYPE_GET_BUFFER ext[0].buffer_p.get_buffer
|
||||
#define MP_TYPE_PROTOCOL ext[0].protocol
|
||||
extern mp_call_fun_t mp_type_get_call_slot(const mp_obj_type_t *);
|
||||
extern mp_unary_op_fun_t mp_type_unary_op(const mp_obj_type_t *);
|
||||
extern mp_unary_op_fun_t mp_type_get_unary_op_slot(const mp_obj_type_t *);
|
||||
extern mp_binary_op_fun_t mp_type_binary_op(const mp_obj_type_t *);
|
||||
extern mp_subscr_fun_t mp_type_subscr(const mp_obj_type_t *);
|
||||
extern mp_getiter_fun_t mp_type_getiter(const mp_obj_type_t *);
|
||||
|
|
|
@ -282,7 +282,7 @@ mp_obj_t mp_unary_op(mp_unary_op_t op, mp_obj_t arg) {
|
|||
return MP_OBJ_NEW_SMALL_INT(h);
|
||||
} else {
|
||||
const mp_obj_type_t *type = mp_obj_get_type(arg);
|
||||
mp_unary_op_fun_t unary_op = mp_type_unary_op(type);
|
||||
mp_unary_op_fun_t unary_op = mp_type_get_unary_op_slot(type);
|
||||
if (unary_op != NULL) {
|
||||
mp_obj_t result = unary_op(op, arg);
|
||||
if (result != MP_OBJ_NULL) {
|
||||
|
|
Loading…
Reference in New Issue