diff options
author | wanabe <s.wanabe@gmail.com> | 2020-08-08 11:29:51 +0900 |
---|---|---|
committer | wanabe <s.wanabe@gmail.com> | 2020-10-16 08:37:04 +0900 |
commit | 65ae7f347a9b44c62ed68870c0a59fd333e6784d (patch) | |
tree | 65c8b3697ac3d1c997a8e76638b40021283e679d /compile.c | |
parent | ce7a053475cbebfb2f3e5ed6614e0ba631541917 (diff) |
Adjust sp for `if true or ...`/`if false and ...`
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3445
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -3889,7 +3889,10 @@ compile_branch_condition(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *co LABEL *label = NEW_LABEL(nd_line(cond)); CHECK(compile_branch_condition(iseq, ret, cond->nd_1st, label, else_label)); - if (!label->refcnt) break; + if (!label->refcnt) { + ADD_INSN(ret, nd_line(cond), putnil); + break; + } ADD_LABEL(ret, label); cond = cond->nd_2nd; goto again; @@ -3899,7 +3902,10 @@ compile_branch_condition(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *co LABEL *label = NEW_LABEL(nd_line(cond)); CHECK(compile_branch_condition(iseq, ret, cond->nd_1st, then_label, label)); - if (!label->refcnt) break; + if (!label->refcnt) { + ADD_INSN(ret, nd_line(cond), putnil); + break; + } ADD_LABEL(ret, label); cond = cond->nd_2nd; goto again; |