diff options
author | Damien George <damien.p.george@gmail.com> | 2014-02-15 19:33:11 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-02-15 19:33:11 +0000 |
commit | 8725f8f7debb9b798783f5aae291d00a3950d8fc (patch) | |
tree | 899bf8b1028850e16b3dd885351931686823cfa2 /py/runtime.c | |
parent | c5966128c7c8a768f6726f299d85d5daef6bed48 (diff) | |
download | micropython-8725f8f7debb9b798783f5aae291d00a3950d8fc.tar.gz micropython-8725f8f7debb9b798783f5aae291d00a3950d8fc.zip |
py: Pass all scope flags through to runtime.
Diffstat (limited to 'py/runtime.c')
-rw-r--r-- | py/runtime.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/py/runtime.c b/py/runtime.c index 68b8fe0778..aa7940fd8e 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -46,7 +46,7 @@ typedef enum { typedef struct _mp_code_t { struct { mp_code_kind_t kind : 8; - bool is_generator : 1; + uint scope_flags : 8; }; struct { uint n_args : 16; @@ -242,12 +242,12 @@ STATIC void alloc_unique_codes(void) { } } -void rt_assign_byte_code(uint unique_code_id, byte *code, uint len, int n_args, int n_locals, int n_stack, bool is_generator) { +void rt_assign_byte_code(uint unique_code_id, byte *code, uint len, int n_args, int n_locals, int n_stack, uint scope_flags) { alloc_unique_codes(); assert(1 <= unique_code_id && unique_code_id < next_unique_code_id && unique_codes[unique_code_id].kind == MP_CODE_NONE); unique_codes[unique_code_id].kind = MP_CODE_BYTE; - unique_codes[unique_code_id].is_generator = is_generator; + unique_codes[unique_code_id].scope_flags = scope_flags; unique_codes[unique_code_id].n_args = n_args; unique_codes[unique_code_id].n_state = n_locals + n_stack; unique_codes[unique_code_id].u_byte.code = code; @@ -275,7 +275,7 @@ void rt_assign_native_code(uint unique_code_id, void *fun, uint len, int n_args) assert(1 <= unique_code_id && unique_code_id < next_unique_code_id && unique_codes[unique_code_id].kind == MP_CODE_NONE); unique_codes[unique_code_id].kind = MP_CODE_NATIVE; - unique_codes[unique_code_id].is_generator = false; + unique_codes[unique_code_id].scope_flags = 0; unique_codes[unique_code_id].n_args = n_args; unique_codes[unique_code_id].n_state = 0; unique_codes[unique_code_id].u_native.fun = fun; @@ -307,7 +307,7 @@ void rt_assign_inline_asm_code(uint unique_code_id, void *fun, uint len, int n_a assert(1 <= unique_code_id && unique_code_id < next_unique_code_id && unique_codes[unique_code_id].kind == MP_CODE_NONE); unique_codes[unique_code_id].kind = MP_CODE_INLINE_ASM; - unique_codes[unique_code_id].is_generator = false; + unique_codes[unique_code_id].scope_flags = 0; unique_codes[unique_code_id].n_args = n_args; unique_codes[unique_code_id].n_state = 0; unique_codes[unique_code_id].u_inline_asm.fun = fun; @@ -728,7 +728,7 @@ mp_obj_t rt_make_function_from_id(int unique_code_id, mp_obj_t def_args) { } // check for generator functions and if so wrap in generator object - if (c->is_generator) { + if ((c->scope_flags & MP_SCOPE_FLAG_GENERATOR) != 0) { fun = mp_obj_new_gen_wrap(fun); } |