diff options
author | Damien George <damien.p.george@gmail.com> | 2014-02-01 21:56:25 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-02-01 21:56:25 +0000 |
commit | e24b563796c19245e5144d4e6ff0833bc4a2ef78 (patch) | |
tree | 3128deac03d496c96dd44b6198a5f57a7fc2ce11 | |
parent | cbddb279bba5395ad444cb46d78223c8f9064c56 (diff) | |
download | micropython-e24b563796c19245e5144d4e6ff0833bc4a2ef78.tar.gz micropython-e24b563796c19245e5144d4e6ff0833bc4a2ef78.zip |
py: Fix emitcpy so continue is compatible with CPython.
-rw-r--r-- | py/emitcpy.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/py/emitcpy.c b/py/emitcpy.c index 2e5c34cb2b..1e507a5819 100644 --- a/py/emitcpy.c +++ b/py/emitcpy.c @@ -456,18 +456,21 @@ static void emit_cpy_setup_loop(emit_t *emit, int label) { } } -static void emit_cpy_break_loop(emit_t *emit, int label) { +static void emit_cpy_break_loop(emit_t *emit, int label, int except_depth) { emit_pre(emit, 0, 1); if (emit->pass == PASS_3) { - printf("BREAK_LOOP\n"); // CPython doesn't have label - //printf("BREAK_LOOP %d\n", emit->label_offsets[label]); + printf("BREAK_LOOP\n"); } } -static void emit_cpy_continue_loop(emit_t *emit, int label) { - emit_pre(emit, 0, 3); - if (emit->pass == PASS_3) { - printf("CONTINUE_LOOP %d\n", emit->label_offsets[label]); +static void emit_cpy_continue_loop(emit_t *emit, int label, int except_depth) { + if (except_depth == 0) { + emit_cpy_jump(emit, label); + } else { + emit_pre(emit, 0, 3); + if (emit->pass == PASS_3) { + printf("CONTINUE_LOOP %d\n", emit->label_offsets[label]); + } } } |