py: Implement basic with support in native emitter.

This commit is contained in:
Damien George
2016-04-07 08:53:24 +01:00
parent ce8b4e8749
commit 2c915e1ae6
3 changed files with 116 additions and 13 deletions

View File

@@ -1624,6 +1624,11 @@ STATIC void compile_with_stmt_helper(compiler_t *comp, int n, mp_parse_node_t *n
compile_node(comp, body);
} else {
uint l_end = comp_next_label(comp);
if (MICROPY_EMIT_NATIVE && comp->scope_cur->emit_options != MP_EMIT_OPT_BYTECODE) {
// we need to allocate an extra label for the native emitter
// it will use l_end+1 as an auxiliary label
comp_next_label(comp);
}
if (MP_PARSE_NODE_IS_STRUCT_KIND(nodes[0], PN_with_item)) {
// this pre-bit is of the form "a as b"
mp_parse_node_struct_t *pns = (mp_parse_node_struct_t*)nodes[0];