kopia lustrzana https://github.com/micropython/micropython
py: Simplify objfun/objgenerator connection, no need to call bc_get.
rodzic
d89b69eb3a
commit
de7c425139
1
py/obj.h
1
py/obj.h
|
@ -496,7 +496,6 @@ typedef struct _mp_obj_fun_native_t { // need this so we can define const object
|
||||||
// such functions won't be able to access the global scope, but that's probably okay
|
// such functions won't be able to access the global scope, but that's probably okay
|
||||||
} mp_obj_fun_native_t;
|
} mp_obj_fun_native_t;
|
||||||
|
|
||||||
void mp_obj_fun_bc_get(mp_obj_t self_in, int *n_args, const byte **code);
|
|
||||||
bool mp_obj_fun_prepare_simple_args(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args,
|
bool mp_obj_fun_prepare_simple_args(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_t *args,
|
||||||
uint *out_args1_len, const mp_obj_t **out_args1, uint *out_args2_len, const mp_obj_t **out_args2);
|
uint *out_args1_len, const mp_obj_t **out_args1, uint *out_args2_len, const mp_obj_t **out_args2);
|
||||||
|
|
||||||
|
|
|
@ -375,13 +375,6 @@ mp_obj_t mp_obj_new_fun_bc(uint scope_flags, qstr *args, uint n_args, mp_obj_t d
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mp_obj_fun_bc_get(mp_obj_t self_in, int *n_args, const byte **code) {
|
|
||||||
assert(MP_OBJ_IS_TYPE(self_in, &mp_type_fun_bc));
|
|
||||||
mp_obj_fun_bc_t *self = self_in;
|
|
||||||
*n_args = self->n_args;
|
|
||||||
*code = self->bytecode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* inline assembler functions */
|
/* inline assembler functions */
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,6 @@ STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp
|
||||||
mp_obj_gen_wrap_t *self = self_in;
|
mp_obj_gen_wrap_t *self = self_in;
|
||||||
mp_obj_fun_bc_t *self_fun = (mp_obj_fun_bc_t*)self->fun;
|
mp_obj_fun_bc_t *self_fun = (mp_obj_fun_bc_t*)self->fun;
|
||||||
assert(MP_OBJ_IS_TYPE(self_fun, &mp_type_fun_bc));
|
assert(MP_OBJ_IS_TYPE(self_fun, &mp_type_fun_bc));
|
||||||
int bc_n_args;
|
|
||||||
const byte *bc_code;
|
|
||||||
mp_obj_fun_bc_get(self_fun, &bc_n_args, &bc_code);
|
|
||||||
|
|
||||||
const mp_obj_t *args1, *args2;
|
const mp_obj_t *args1, *args2;
|
||||||
uint len1, len2;
|
uint len1, len2;
|
||||||
|
@ -36,7 +33,7 @@ STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mp_obj_new_gen_instance(self_fun->globals, bc_code, len1, args1, len2, args2);
|
return mp_obj_new_gen_instance(self_fun->globals, self_fun->bytecode, len1, args1, len2, args2);
|
||||||
}
|
}
|
||||||
|
|
||||||
const mp_obj_type_t mp_type_gen_wrap = {
|
const mp_obj_type_t mp_type_gen_wrap = {
|
||||||
|
|
Ładowanie…
Reference in New Issue