aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-22 16:02:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-22 16:02:03 +0000
commit7ce222012659a6f9ee843a8c08504e857c4af661 (patch)
tree2d53376214da62711f6bfecfafb3acf7d609a60b /compile.c
parent0f199f6ff8a818336ebc5f1b842cfda7374a2b03 (diff)
downloadruby-7ce222012659a6f9ee843a8c08504e857c4af661.tar.gz
compile.c: pop literal object in condition
* compile.c (compile_branch_condition): pop dynamic literal object, which is never nil/false, as the branch condition. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index efa001a7d4..2631a97aed 100644
--- a/compile.c
+++ b/compile.c
@@ -3717,6 +3717,13 @@ compile_branch_condition(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *co
/* printf("useless condition eliminate (%s)\n", ruby_node_name(nd_type(cond))); */
ADD_INSNL(ret, nd_line(cond), jump, else_label);
break;
+ case NODE_ARRAY:
+ case NODE_ARGSCAT:
+ case NODE_DREGX:
+ case NODE_DSTR:
+ CHECK(COMPILE_POPPED(ret, "branch condition", cond));
+ ADD_INSNL(ret, nd_line(cond), jump, then_label);
+ break;
case NODE_FLIP2:
CHECK(compile_flip_flop(iseq, ret, cond, TRUE, then_label, else_label));
break;