ruby-changes:60747
From: Nobuyoshi <ko1@a...>
Date: Sun, 12 Apr 2020 00:19:54 +0900 (JST)
Subject: [ruby-changes:60747] 022c7bbea9 (master): Relaxed of R-assign value to arg
https://git.ruby-lang.org/ruby.git/commit/?id=022c7bbea9 From 022c7bbea98ef41556941a21ef6f0656bb49c75f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 12 Apr 2020 00:07:57 +0900 Subject: Relaxed of R-assign value to arg diff --git a/parse.y b/parse.y index 794e676..2c5eaf1 100644 --- a/parse.y +++ b/parse.y @@ -1506,18 +1506,16 @@ stmt : keyword_alias fitem {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem https://github.com/ruby/ruby/blob/trunk/parse.y#L1506 | expr ; -rassign : primary tASSOC lhs +rassign : arg_value tASSOC lhs { /*%%%*/ - value_expr($1); $$ = node_assign(p, $3, $1, &@$); /*% %*/ /*% ripper: assign!($3, $1) %*/ } - | primary tASSOC mlhs + | arg_value tASSOC mlhs { /*%%%*/ - value_expr($1); $$ = node_assign(p, $3, $1, &@$); /*% %*/ /*% ripper: massign!($3, $1) %*/ @@ -1525,7 +1523,6 @@ rassign : primary tASSOC lhs https://github.com/ruby/ruby/blob/trunk/parse.y#L1523 | rassign tASSOC lhs { /*%%%*/ - value_expr($1); $$ = node_assign(p, $3, $1, &@$); /*% %*/ /*% ripper: assign!($3, $1) %*/ @@ -1533,7 +1530,6 @@ rassign : primary tASSOC lhs https://github.com/ruby/ruby/blob/trunk/parse.y#L1530 | rassign tASSOC mlhs { /*%%%*/ - value_expr($1); $$ = node_assign(p, $3, $1, &@$); /*% %*/ /*% ripper: massign!($3, $1) %*/ diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 825d5e1..29813ce 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -1571,6 +1571,7 @@ eom https://github.com/ruby/ruby/blob/trunk/test/ruby/test_syntax.rb#L1571 assert_equal([2,3], eval("13.divmod(5) => a,b; [a, b]")) assert_equal([2,3,2,3], eval("13.divmod(5) => a,b => c, d; [a, b, c, d]")) assert_equal([2,3], eval("13.divmod(5)\n => a,b; [a, b]")) + assert_equal(3, eval("1+2 => a")) end private -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/