Project

General

Profile

Bug #8279 ยป massign-rescue-modifier-8279.patch

jeremyevans0 (Jeremy Evans), 08/09/2019 03:10 AM

View differences:

parse.y
/*% %*/
/*% ripper: assign!($1, $3) %*/
}
| mlhs '=' mrhs_arg modifier_rescue stmt
{
/*%%%*/
YYLTYPE loc = code_loc_gen(&@4, &@5);
value_expr($3);
$$ = node_assign(p, $1, NEW_RESCUE($3, NEW_RESBODY(0, remove_begin($5), 0, &loc), 0, &@$), &@$);
/*% %*/
/*% ripper: massign!($1, rescue_mod!($3, $5)) %*/
}
| mlhs '=' mrhs_arg
{
/*%%%*/
test/ruby/test_assignment.rb
a,b,*c = *[*[1,2]]; assert_equal([1,2,[]], [a,b,c])
end
def test_assign_rescue
a = raise rescue 2; assert_equal(2, a)
a, b = raise rescue [3,4]; assert_equal([3, 4], [a, b])
end
def test_assign_abbreviated
bug2050 = '[ruby-core:25629]'
a = Hash.new {[]}
    (1-1/1)