From 65ae7f347a9b44c62ed68870c0a59fd333e6784d Mon Sep 17 00:00:00 2001 From: wanabe Date: Sat, 8 Aug 2020 11:29:51 +0900 Subject: Adjust sp for `if true or ...`/`if false and ...` --- compile.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 015cbc7333..0b9c276e1f 100644 --- a/compile.c +++ b/compile.c @@ -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; -- cgit v1.2.3