зеркало из https://github.com/github/ruby.git
Relaxed of R-assign value to arg
This commit is contained in:
Родитель
93edbb4c08
Коммит
022c7bbea9
8
parse.y
8
parse.y
|
@ -1506,18 +1506,16 @@ stmt : keyword_alias fitem {SET_LEX_STATE(EXPR_FNAME|EXPR_FITEM);} fitem
|
|||
| 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
|
|||
| rassign tASSOC lhs
|
||||
{
|
||||
/*%%%*/
|
||||
value_expr($1);
|
||||
$$ = node_assign(p, $3, $1, &@$);
|
||||
/*% %*/
|
||||
/*% ripper: assign!($3, $1) %*/
|
||||
|
@ -1533,7 +1530,6 @@ rassign : primary tASSOC lhs
|
|||
| rassign tASSOC mlhs
|
||||
{
|
||||
/*%%%*/
|
||||
value_expr($1);
|
||||
$$ = node_assign(p, $3, $1, &@$);
|
||||
/*% %*/
|
||||
/*% ripper: massign!($3, $1) %*/
|
||||
|
|
|
@ -1571,6 +1571,7 @@ eom
|
|||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче