diff options
author | Damien <damien.p.george@gmail.com> | 2013-10-20 15:07:49 +0100 |
---|---|---|
committer | Damien <damien.p.george@gmail.com> | 2013-10-20 15:07:49 +0100 |
commit | 27fb45eb1c95f9cc02f4ed1b9d573ece0d4c1a18 (patch) | |
tree | ceac81236ebc3e0dcd201888f251016cb2af50ba /py/compile.c | |
parent | a5185f4bc8f60fb2be82580e6f2d93fec53d0a33 (diff) |
Add local_num skeleton framework to deref/closure emit calls.
Diffstat (limited to 'py/compile.c')
-rw-r--r-- | py/compile.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/py/compile.c b/py/compile.c index d622242b6..ede09058f 100644 --- a/py/compile.c +++ b/py/compile.c @@ -721,7 +721,7 @@ void close_over_variables_etc(compiler_t *comp, scope_t *this_scope, int n_dict_ for (int i = 0; i < this_scope->id_info_len; i++) { id_info_t *id_info = &this_scope->id_info[i]; if (id_info->kind == ID_INFO_KIND_FREE) { - EMIT(load_closure, id_info->qstr); + EMIT(load_closure, id_info->qstr, id_info->local_num); nfree += 1; } } @@ -2624,7 +2624,7 @@ void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) { if (id->kind == ID_INFO_KIND_LOCAL) { EMIT(load_const_tok, PY_TOKEN_KW_NONE); } else { - EMIT(load_closure, comp->qstr___class__); + EMIT(load_closure, comp->qstr___class__, 0); // XXX check this is the correct local num } EMIT(return_value); } @@ -2729,6 +2729,8 @@ void compile_scope_compute_things(compiler_t *comp, scope_t *scope) { } } + // TODO compute the index of free and cell vars (freevars[idx] in CPython) + // compute flags //scope->flags = 0; since we set some things in parameters if (scope->kind != SCOPE_MODULE) { |