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

ruby-changes:45186

From: nobu <ko1@a...>
Date: Tue, 3 Jan 2017 19:49:19 +0900 (JST)
Subject: [ruby-changes:45186] nobu:r57259 (trunk): compile.c: fallback nil

nobu	2017-01-03 19:49:12 +0900 (Tue, 03 Jan 2017)

  New Revision: 57259

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

  Log:
    compile.c: fallback nil
    
    * compile.c (iseq_compile_each): push fallback nil only when
      defined guard is added.

  Modified files:
    trunk/compile.c
Index: compile.c
===================================================================
--- compile.c	(revision 57258)
+++ compile.c	(revision 57259)
@@ -6107,13 +6107,14 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ https://github.com/ruby/ruby/blob/trunk/compile.c#L6107
 	}
 	else {
 	    LABEL *lfinish[2];
+	    LINK_ELEMENT *last = ret->last;
 	    lfinish[0] = NEW_LABEL(line);
 	    lfinish[1] = 0;
-	    ADD_INSN(ret, line, putnil);
 	    defined_expr(iseq, ret, node->nd_head, lfinish, Qtrue);
-	    ADD_INSN(ret, line, swap);
-	    ADD_INSN(ret, line, pop);
 	    if (lfinish[1]) {
+		INSERT_ELEM_NEXT(last, &new_insn_body(iseq, line, BIN(putnil), 0)->link);
+		ADD_INSN(ret, line, swap);
+		ADD_INSN(ret, line, pop);
 		ADD_LABEL(ret, lfinish[1]);
 	    }
 	    ADD_LABEL(ret, lfinish[0]);

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

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