Merge pull request #2099 from nobu/optional_arguments_in_rhs

Optional arguments in rhs
This commit is contained in:
Yukihiro "Matz" Matsumoto
2014-04-21 14:58:26 +09:00
2 changed files with 7 additions and 4 deletions
+3 -4
View File
@@ -3061,14 +3061,13 @@ f_opt_asgn : tIDENTIFIER '='
f_opt : f_opt_asgn arg_value
{
$$ = cons(nsym($1), $2);
$$ = cons(nsym($1), $2);
}
;
f_block_opt : tIDENTIFIER '=' primary_value
f_block_opt : f_opt_asgn primary_value
{
local_add_f(p, $1);
$$ = cons(nsym($1), $3);
$$ = cons(nsym($1), $2);
}
;
+4
View File
@@ -289,3 +289,7 @@ assert('optional argument in the rhs default expressions') do
assert_nil(o.t)
assert_equal("method called", o.t2)
end
assert('optional block argument in the rhs default expressions') do
assert_nil(proc {|foo = foo| foo}.call)
end