summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/parse.y5
-rw-r--r--test/t/syntax.rb4
2 files changed, 6 insertions, 3 deletions
diff --git a/src/parse.y b/src/parse.y
index a8bee8237..43c0c7321 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -3065,10 +3065,9 @@ f_opt : f_opt_asgn arg_value
}
;
-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);
}
;
diff --git a/test/t/syntax.rb b/test/t/syntax.rb
index 245c5c099..83243a99f 100644
--- a/test/t/syntax.rb
+++ b/test/t/syntax.rb
@@ -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