summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--parse.y2
-rw-r--r--test/ruby/test_syntax.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index 29e9ce0555..847e13e4da 100644
--- a/parse.y
+++ b/parse.y
@@ -5286,7 +5286,7 @@ block_call : command do_block
| block_call call_op2 operation2 opt_paren_args brace_block
{
bool has_args = $5 != 0;
- if (NODE_EMPTY_ARGS_P($5)) $5 = 0;
+ if (NODE_EMPTY_ARGS_P($4)) $4 = 0;
$$ = new_command_qcall(p, $2, $1, $3, $4, $5, &@3, &@$);
/*% ripper: command_call!($:1, $:2, $:3, $:4) %*/
if (has_args) {
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 8aa3a54084..dc752d5d8a 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1829,6 +1829,10 @@ eom
assert_valid_syntax('a.b (;),(),()', bug19281)
end
+ def test_command_do_block_call_with_empty_args_brace_block
+ assert_valid_syntax('cmd 1, 2 do end.m() { blk_body }')
+ end
+
def test_numbered_parameter
assert_valid_syntax('proc {_1}')
assert_equal(3, eval('[1,2].then {_1+_2}'))