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

ruby-changes:60869

From: Nobuyoshi <ko1@a...>
Date: Wed, 22 Apr 2020 22:01:09 +0900 (JST)
Subject: [ruby-changes:60869] 02ad393cd6 (master): Revert "Allow simple R-assign in endless def"

https://git.ruby-lang.org/ruby.git/commit/?id=02ad393cd6

From 02ad393cd6bd87a7cc21ef71d5b21ad0f3fe2f34 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 22 Apr 2020 18:56:06 +0900
Subject: Revert "Allow simple R-assign in endless def"

This reverts commit 67bcac879a2e0ddfb4e7bbd7cb5e5401422de76a.

diff --git a/parse.y b/parse.y
index 4827515..18f776e 100644
--- a/parse.y
+++ b/parse.y
@@ -1104,7 +1104,7 @@ static int looking_at_eol_p(struct parser_params *p); https://github.com/ruby/ruby/blob/trunk/parse.y#L1104
 %type <node> string_contents xstring_contents regexp_contents string_content
 %type <node> words symbols symbol_list qwords qsymbols word_list qword_list qsym_list word
 %type <node> literal numeric simple_numeric ssym dsym symbol cpath def_name defn_head defs_head
-%type <node> top_compstmt top_stmts top_stmt begin_block rassign arg_rassign
+%type <node> top_compstmt top_stmts top_stmt begin_block rassign
 %type <node> bodystmt compstmt stmts stmt_or_begin stmt expr arg primary command command_call method_call
 %type <node> expr_value expr_value_do arg_value primary_value fcall rel_expr
 %type <node> if_tail opt_else case_body case_args cases opt_rescue exc_list exc_var opt_ensure
@@ -1195,7 +1195,6 @@ static int looking_at_eol_p(struct parser_params *p); https://github.com/ruby/ruby/blob/trunk/parse.y#L1195
 
 %nonassoc tLOWEST
 %nonassoc tLBRACE_ARG
-%left tASSOC
 
 %nonassoc  modifier_if modifier_unless modifier_while modifier_until keyword_in
 %left  keyword_or keyword_and
@@ -1537,19 +1536,6 @@ rassign 	: arg_value tASSOC lhs https://github.com/ruby/ruby/blob/trunk/parse.y#L1536
 		    }
 		;
 
-arg_rassign	: arg tASSOC lhs %prec tLOWEST
-		    {
-		    /*%%%*/
-			$$ = node_assign(p, $3, $1, &@$);
-		    /*% %*/
-		    /*% ripper: assign!($3, $1) %*/
-		    }
-		| arg %prec tLOWEST
-		    {
-			$$ = $1;
-		    }
-		;
-
 command_asgn	: lhs '=' command_rhs
 		    {
 		    /*%%%*/
@@ -2459,7 +2445,7 @@ arg		: lhs '=' arg_rhs https://github.com/ruby/ruby/blob/trunk/parse.y#L2445
 		    /*% %*/
 		    /*% ripper: ifop!($1, $3, $6) %*/
 		    }
-		| defn_head f_arglist_opt '=' arg_rassign
+		| defn_head f_arglist_opt '=' arg
 		    {
 			restore_defun(p, $<node>1->nd_defn);
 		    /*%%%*/
@@ -2468,7 +2454,7 @@ arg		: lhs '=' arg_rhs https://github.com/ruby/ruby/blob/trunk/parse.y#L2454
 		    /*% ripper: def!(get_value($1), $2, $4) %*/
 			local_pop(p);
 		    }
-		| defs_head f_arglist_opt '=' arg_rassign
+		| defs_head f_arglist_opt '=' arg
 		    {
 			restore_defun(p, $<node>1->nd_defn);
 		    /*%%%*/
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index ddb813f..2f81d72 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1419,7 +1419,6 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L1419
     assert_valid_syntax('private def inc(x) = x + 1')
     assert_valid_syntax('private def obj.foo = 42')
     assert_valid_syntax('private def obj.inc(x) = x + 1')
-    assert_valid_syntax('private def obj.inc(x) = x + 1 => @x')
   end
 
   def test_methoddef_in_cond
-- 
cgit v0.10.2


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

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