diff options
author | wanabe <s.wanabe@gmail.com> | 2020-08-08 16:08:47 +0900 |
---|---|---|
committer | Kazuki Tsujimoto <kazuki@callcc.net> | 2020-08-16 18:39:08 +0900 |
commit | 0759862458c25bb8a7832090545c625c364e5d94 (patch) | |
tree | a1be34d26a500f7f33ebff9d1777552e4564da52 /compile.c | |
parent | c1e7f0c709389a230f8032f3e1fc66148e935425 (diff) |
Adjust sp for pattern matching implicit/explicit "else"
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3403
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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); |