Add local_num skeleton framework to deref/closure emit calls.
diff --git a/py/compile.c b/py/compile.c
index d622242..ede0905 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -721,7 +721,7 @@
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 @@
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 @@
}
}
+ // 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) {