py: work towards working closures.
diff --git a/py/emitcpy.c b/py/emitcpy.c
index 428e6fd..a1d03ec 100644
--- a/py/emitcpy.c
+++ b/py/emitcpy.c
@@ -265,20 +265,6 @@
}
}
-static void emit_cpy_load_name(emit_t *emit, qstr qstr) {
- emit_pre(emit, 1, 3);
- if (emit->pass == PASS_3) {
- printf("LOAD_NAME %s\n", qstr_str(qstr));
- }
-}
-
-static void emit_cpy_load_global(emit_t *emit, qstr qstr) {
- emit_pre(emit, 1, 3);
- if (emit->pass == PASS_3) {
- printf("LOAD_GLOBAL %s\n", qstr_str(qstr));
- }
-}
-
static void emit_cpy_load_deref(emit_t *emit, qstr qstr, int local_num) {
emit_pre(emit, 1, 3);
if (emit->pass == PASS_3) {
@@ -293,6 +279,20 @@
}
}
+static void emit_cpy_load_name(emit_t *emit, qstr qstr) {
+ emit_pre(emit, 1, 3);
+ if (emit->pass == PASS_3) {
+ printf("LOAD_NAME %s\n", qstr_str(qstr));
+ }
+}
+
+static void emit_cpy_load_global(emit_t *emit, qstr qstr) {
+ emit_pre(emit, 1, 3);
+ if (emit->pass == PASS_3) {
+ printf("LOAD_GLOBAL %s\n", qstr_str(qstr));
+ }
+}
+
static void emit_cpy_load_attr(emit_t *emit, qstr qstr) {
emit_pre(emit, 0, 3);
if (emit->pass == PASS_3) {
@@ -318,6 +318,13 @@
}
}
+static void emit_cpy_store_deref(emit_t *emit, qstr qstr, int local_num) {
+ emit_pre(emit, -1, 3);
+ if (emit->pass == PASS_3) {
+ printf("STORE_DEREF %d %s\n", local_num, qstr_str(qstr));
+ }
+}
+
static void emit_cpy_store_name(emit_t *emit, qstr qstr) {
emit_pre(emit, -1, 3);
if (emit->pass == PASS_3) {
@@ -332,13 +339,6 @@
}
}
-static void emit_cpy_store_deref(emit_t *emit, qstr qstr, int local_num) {
- emit_pre(emit, -1, 3);
- if (emit->pass == PASS_3) {
- printf("STORE_DEREF %d %s\n", local_num, qstr_str(qstr));
- }
-}
-
static void emit_cpy_store_attr(emit_t *emit, qstr qstr) {
emit_pre(emit, -2, 3);
if (emit->pass == PASS_3) {
@@ -367,6 +367,13 @@
}
}
+static void emit_cpy_delete_deref(emit_t *emit, qstr qstr, int local_num) {
+ emit_pre(emit, 0, 3);
+ if (emit->pass == PASS_3) {
+ printf("DELETE_DEREF %d %s\n", local_num, qstr_str(qstr));
+ }
+}
+
static void emit_cpy_delete_name(emit_t *emit, qstr qstr) {
emit_pre(emit, 0, 3);
if (emit->pass == PASS_3) {
@@ -381,13 +388,6 @@
}
}
-static void emit_cpy_delete_deref(emit_t *emit, qstr qstr, int local_num) {
- emit_pre(emit, 0, 3);
- if (emit->pass == PASS_3) {
- printf("DELETE_DEREF %d %s\n", local_num, qstr_str(qstr));
- }
-}
-
static void emit_cpy_delete_attr(emit_t *emit, qstr qstr) {
emit_pre(emit, -1, 3);
if (emit->pass == PASS_3) {
@@ -852,24 +852,24 @@
emit_cpy_load_const_verbatim_quoted_str,
emit_cpy_load_const_verbatim_end,
emit_cpy_load_fast,
- emit_cpy_load_name,
- emit_cpy_load_global,
emit_cpy_load_deref,
emit_cpy_load_closure,
+ emit_cpy_load_name,
+ emit_cpy_load_global,
emit_cpy_load_attr,
emit_cpy_load_method,
emit_cpy_load_build_class,
emit_cpy_store_fast,
+ emit_cpy_store_deref,
emit_cpy_store_name,
emit_cpy_store_global,
- emit_cpy_store_deref,
emit_cpy_store_attr,
emit_cpy_store_subscr,
emit_cpy_store_locals,
emit_cpy_delete_fast,
+ emit_cpy_delete_deref,
emit_cpy_delete_name,
emit_cpy_delete_global,
- emit_cpy_delete_deref,
emit_cpy_delete_attr,
emit_cpy_delete_subscr,
emit_cpy_dup_top,