summaryrefslogtreecommitdiffstatshomepage
path: root/py/compile.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-03-29 04:10:11 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-03-29 04:39:24 +0200
commit44307d5ef8f1c78d0a393e8ab842d18799d56517 (patch)
treec8bb8372d31106191864cb7d009adae8fc61c6de /py/compile.c
parent682f9e639d140849a5b33aecb74e2e2cb2c6ee77 (diff)
downloadmicropython-44307d5ef8f1c78d0a393e8ab842d18799d56517.tar.gz
micropython-44307d5ef8f1c78d0a393e8ab842d18799d56517.zip
vm: Implement "with" statement (SETUP_WITH and WITH_CLEANUP bytecodes).
Diffstat (limited to 'py/compile.c')
-rw-r--r--py/compile.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/py/compile.c b/py/compile.c
index b3a83715e0..9e6c4e5fe4 100644
--- a/py/compile.c
+++ b/py/compile.c
@@ -1798,6 +1798,7 @@ void compile_with_stmt_helper(compiler_t *comp, int n, mp_parse_node_t *nodes, m
EMIT_ARG(setup_with, l_end);
EMIT(pop_top);
}
+ compile_increase_except_level(comp);
// compile additional pre-bits and the body
compile_with_stmt_helper(comp, n - 1, nodes + 1, body);
// finish this with block
@@ -1805,6 +1806,7 @@ void compile_with_stmt_helper(compiler_t *comp, int n, mp_parse_node_t *nodes, m
EMIT_ARG(load_const_tok, MP_TOKEN_KW_NONE);
EMIT_ARG(label_assign, l_end);
EMIT(with_cleanup);
+ compile_decrease_except_level(comp);
EMIT(end_finally);
}
}