diff --git a/fixtures/small/anonymous_blockarg_actual.rb b/fixtures/small/anonymous_blockarg_actual.rb index 2ce2f4ad..4d1fce92 100644 --- a/fixtures/small/anonymous_blockarg_actual.rb +++ b/fixtures/small/anonymous_blockarg_actual.rb @@ -1,3 +1,25 @@ def foo(a, b, &) bar a, b, & end + +def foo( + a, + & +) + bar( + a, + &) +end + +def foo( + a, + *b, + & +) +bar( + a, + b, + & + ) +end + diff --git a/fixtures/small/anonymous_blockarg_expected.rb b/fixtures/small/anonymous_blockarg_expected.rb index 741c607a..2f24638a 100644 --- a/fixtures/small/anonymous_blockarg_expected.rb +++ b/fixtures/small/anonymous_blockarg_expected.rb @@ -1,3 +1,25 @@ def foo(a, b, &) bar(a, b, &) end + +def foo( + a, + & +) + bar( + a, + & + ) +end + +def foo( + a, + *b, + & +) + bar( + a, + b, + & + ) +end diff --git a/librubyfmt/src/format_prism.rs b/librubyfmt/src/format_prism.rs index d27e4bf6..0b2b1b8c 100644 --- a/librubyfmt/src/format_prism.rs +++ b/librubyfmt/src/format_prism.rs @@ -1639,6 +1639,8 @@ fn format_block_parameter_node<'src>( let ident_str = ident.as_slice(); ps.bind_variable(ident_str); handle_string_at_offset(ps, ident_str, block_arg.name_loc().unwrap().end_offset()); + } else { + ps.at_offset(block_arg.location().start_offset()); } }); }