Adjust sp for pattern matching implicit/explicit "else"

This commit is contained in:
wanabe 2020-08-08 16:08:47 +09:00 committed by Kazuki Tsujimoto
parent c1e7f0c709
commit 0759862458
Notes: git 2020-08-16 18:39:44 +09:00

View File

@ -6385,6 +6385,10 @@ compile_case3(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no
add_trace_branch_coverage(iseq, cond_seq, node, branch_id, "else", branches);
CHECK(COMPILE_(cond_seq, "else", node, popped));
ADD_INSNL(cond_seq, line, jump, endlabel);
ADD_INSN(cond_seq, line, putnil);
if (popped) {
ADD_INSN(cond_seq, line, putnil);
}
}
else {
debugs("== else (implicit)\n");
@ -6401,6 +6405,10 @@ compile_case3(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *const orig_no
ADD_INSN(cond_seq, nd_line(orig_node), putnil);
}
ADD_INSNL(cond_seq, nd_line(orig_node), jump, endlabel);
ADD_INSN(cond_seq, line, putnil);
if (popped) {
ADD_INSN(cond_seq, line, putnil);
}
}
ADD_SEQ(ret, cond_seq);