[前][次][番号順一覧][スレッド一覧]

ruby-changes:52304

From: nobu <ko1@a...>
Date: Thu, 23 Aug 2018 01:02:10 +0900 (JST)
Subject: [ruby-changes:52304] nobu:r64512 (trunk): compile.c: pop literal object in condition

nobu	2018-08-23 01:02:03 +0900 (Thu, 23 Aug 2018)

  New Revision: 64512

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64512

  Log:
    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.

  Modified files:
    trunk/compile.c
Index: compile.c
===================================================================
--- compile.c	(revision 64511)
+++ compile.c	(revision 64512)
@@ -3717,6 +3717,13 @@ compile_branch_condition(rb_iseq_t *iseq https://github.com/ruby/ruby/blob/trunk/compile.c#L3717
 	/* 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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]