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

ruby-changes:3790

From: ko1@a...
Date: Sun, 27 Jan 2008 22:55:59 +0900 (JST)
Subject: [ruby-changes:3790] nobu - Ruby:r15279 (trunk): * parse.y (value_expr_gen): reverted r12880.

nobu	2008-01-27 22:55:29 +0900 (Sun, 27 Jan 2008)

  New Revision: 15279

  Modified files:
    trunk/ChangeLog
    trunk/bootstraptest/test_syntax.rb
    trunk/parse.y

  Log:
    * parse.y (value_expr_gen): reverted r12880.  [ruby-dev:33388]


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/parse.y?r1=15279&r2=15278&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15279&r2=15278&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/bootstraptest/test_syntax.rb?r1=15279&r2=15278&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 15278)
+++ ChangeLog	(revision 15279)
@@ -1,3 +1,7 @@
+Sun Jan 27 22:55:27 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* parse.y (value_expr_gen): reverted r12880.  [ruby-dev:33388]
+
 Sun Jan 27 22:33:39 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* sprintf.c (rb_str_format): fix for octal with precision.
Index: bootstraptest/test_syntax.rb
===================================================================
--- bootstraptest/test_syntax.rb	(revision 15278)
+++ bootstraptest/test_syntax.rb	(revision 15279)
@@ -540,8 +540,8 @@
   class << (ary=[]); def []; 0; end; def []=(x); super(0,x);end;end; ary[]+=1
 }, '[ruby-dev:31110]'
 assert_syntax_error "Can't set variable $1", %q{0..$1=1}, '[ruby-dev:31118]'
-assert_syntax_error "void value expression", %q{1.times{1+(1&&next)}}, '[ruby-dev:31119]'
-assert_syntax_error "void value expression", %q{x=-1;loop{x+=1&&redo if (x+=1).zero?}}, '[ruby-dev:31119]'
+assert_valid_syntax %q{1.times{1+(1&&next)}}, '[ruby-dev:31119]'
+assert_valid_syntax %q{x=-1;loop{x+=1&&redo if (x+=1).zero?}}, '[ruby-dev:31119]'
 assert_syntax_error %q{syntax error, unexpected $end}, %q{!}, '[ruby-dev:31243]'
 assert_equal %q{[nil]}, %q{[()]}, '[ruby-dev:31252]'
 assert_equal %q{true}, %q{!_=()}, '[ruby-dev:31263]'
Index: parse.y
===================================================================
--- parse.y	(revision 15278)
+++ parse.y	(revision 15279)
@@ -7831,6 +7831,8 @@
 static int
 value_expr_gen(struct parser_params *parser, NODE *node)
 {
+    int cond = 0;
+
     if (!node) {
 	rb_warning0("empty expression");
     }
@@ -7846,7 +7848,7 @@
 	  case NODE_NEXT:
 	  case NODE_REDO:
 	  case NODE_RETRY:
-	    yyerror("void value expression");
+	    if (!cond) yyerror("void value expression");
 	    /* or "control never reach"? */
 	    return Qfalse;
 
@@ -7868,6 +7870,7 @@
 
 	  case NODE_AND:
 	  case NODE_OR:
+	    cond = 1;
 	    node = node->nd_2nd;
 	    break;
 

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

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