diff options
| author | Damien George | 2014-04-17 19:16:11 +0100 |
|---|---|---|
| committer | Damien George | 2014-04-17 19:16:11 +0100 |
| commit | de7c425139c92745280b62f7ebb756def96d072a (patch) | |
| tree | 640c2127c9c8414d2edeb4f799d1984def46d8a0 | |
| parent | d89b69eb3a8c53e0026e9dfffb1fa5d8da5569f7 (diff) | |
py: Simplify objfun/objgenerator connection, no need to call bc_get.
| -rw-r--r-- | py/obj.h | 1 | ||||
| -rw-r--r-- | py/objfun.c | 7 | ||||
| -rw-r--r-- | py/objgenerator.c | 5 |
3 files changed, 1 insertions, 12 deletions
@@ -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 } 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, uint *out_args1_len, const mp_obj_t **out_args1, uint *out_args2_len, const mp_obj_t **out_args2); diff --git a/py/objfun.c b/py/objfun.c index 66145f4a6..07d6606c5 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -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; } -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 */ diff --git a/py/objgenerator.c b/py/objgenerator.c index 9be7fb197..18807e75f 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -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_fun_bc_t *self_fun = (mp_obj_fun_bc_t*)self->fun; 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; 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); } - 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 = { |
