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

ruby-changes:5557

From: wanabe <ko1@a...>
Date: Mon, 9 Jun 2008 22:49:38 +0900 (JST)
Subject: [ruby-changes:5557] Ruby:r17061 (trunk): * compile.c : treat []&&= in virtually the same way as []||=.

wanabe	2008-06-09 22:49:16 +0900 (Mon, 09 Jun 2008)

  New Revision: 17061

  Modified files:
    trunk/ChangeLog
    trunk/compile.c

  Log:
    * compile.c : treat []&&= in virtually the same way as []||=.
      [ruby-dev:34679]

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/compile.c?r1=17061&r2=17060&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=17061&r2=17060&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 17060)
+++ ChangeLog	(revision 17061)
@@ -1,3 +1,8 @@
+Mon Jun  9 22:46:47 2008  wanabe  <s.wanabe@g...>
+
+	* compile.c : treat []&&= in virtually the same way as []||=.
+	  [ruby-dev:34679]
+
 Mon Jun  9 21:17:26 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* enc/depend (clean): remove build directories.
Index: compile.c
===================================================================
--- compile.c	(revision 17060)
+++ compile.c	(revision 17061)
@@ -3513,7 +3513,9 @@
 	      }
 	      else {
 		  /* and */
+		  ADD_INSN(ret, nd_line(node), dup);
 		  ADD_INSNL(ret, nd_line(node), branchunless, label);
+		  ADD_INSN(ret, nd_line(node), pop);
 	      }
 
 	      COMPILE(ret, "NODE_OP_ASGN1 args->head: ", node->nd_args->nd_head);
@@ -3529,17 +3531,12 @@
 	      }
 	      ADD_INSNL(ret, nd_line(node), jump, lfin);
 	      ADD_LABEL(ret, label);
-	      if (id == 0) {	/* or */
+	      if (id == 0 || id == 1) {	/* 0: or, 1: and */
 		  ADD_INSN(ret, nd_line(node), swap);
 		  ADD_INSN(ret, nd_line(node), pop);
 		  ADD_INSN(ret, nd_line(node), swap);
 		  ADD_INSN(ret, nd_line(node), pop);
 	      }
-	      else if (id == 1) {	/* and */
-		  ADD_INSN(ret, nd_line(node), pop);
-		  ADD_INSN(ret, nd_line(node), pop);
-		  ADD_INSN(ret, nd_line(node), putnil);
-	      }
 	      ADD_LABEL(ret, lfin);
 	  }
 	  else {

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

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