summaryrefslogtreecommitdiff
path: root/py/compile2.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-08-13 21:23:02 +1000
committerDamien George <damien.p.george@gmail.com>2017-08-13 21:23:02 +1000
commit72912c753a31301efb7d6b2f35dd1e3e64b98cd4 (patch)
treed6d52e4cbf5d7021e3b92778b66772df25ee6ea6 /py/compile2.c
parentbe020eb2c3c7e8421ee0989a7a09498a91b974fb (diff)
py: Deoptimise try-finally and subscript parse nodes to match master.
This is a small de-optimisation so that it's easier to merge master into this branch.
Diffstat (limited to 'py/compile2.c')
-rw-r--r--py/compile2.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/py/compile2.c b/py/compile2.c
index 5ef00feaa..ef9e43472 100644
--- a/py/compile2.c
+++ b/py/compile2.c
@@ -1649,6 +1649,8 @@ STATIC void compile_try_except(compiler_t *comp, const byte *p_body, const byte
}
STATIC void compile_try_finally(compiler_t *comp, const byte *p_body, const byte *p_except, const byte *p_except_top, const byte *p_else, const byte *p_finally) {
+ assert(pt_is_rule(p_finally, PN_try_stmt_finally));
+
uint l_finally_block = comp_next_label(comp);
EMIT_ARG(setup_finally, l_finally_block);
@@ -1665,7 +1667,7 @@ STATIC void compile_try_finally(compiler_t *comp, const byte *p_body, const byte
EMIT(pop_block);
EMIT_ARG(load_const_tok, MP_TOKEN_KW_NONE);
EMIT_ARG(label_assign, l_finally_block);
- compile_node(comp, p_finally);
+ compile_node(comp, pt_rule_first(p_finally));
compile_decrease_except_level(comp);
EMIT(end_finally);
@@ -2412,7 +2414,9 @@ STATIC void compile_subscript_3_helper(compiler_t *comp, const byte *p, const by
} else if (pt_is_rule(p, PN_subscript_3d)) {
p = pt_rule_first(p);
p = compile_node(comp, p);
- if (pt_is_rule(p, PN_sliceop)) {
+ assert(pt_is_rule(p, PN_sliceop)); // should always be
+ p = pt_rule_first(p);
+ if (p == ptop) {
// [?:x:]
EMIT_ARG(build_slice, 2);
} else {