Skip to content

Commit

Permalink
[ruby/prism] Implement call shorthand for ripper translation
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton authored and matzbot committed Mar 6, 2024
1 parent 8b721fc commit 75e24a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
9 changes: 7 additions & 2 deletions lib/prism/translation/ripper.rb
Expand Up @@ -646,8 +646,13 @@ def visit_call_node(node)
bounds(node.call_operator_loc)
call_operator = visit_token(node.call_operator)

bounds(node.message_loc)
message = visit_token(node.message)
message =
if node.message_loc.nil?
:call
else
bounds(node.message_loc)
visit_token(node.message)
end

if node.name.end_with?("=") && !node.message.end_with?("=") && !node.arguments.nil? && node.block.nil?
bounds(node.arguments.location)
Expand Down
5 changes: 0 additions & 5 deletions test/prism/ripper_test.rb
Expand Up @@ -55,8 +55,6 @@ class RipperTest < TestCase
seattlerb/call_array_lambda_block_call.txt
seattlerb/call_assoc_trailing_comma.txt
seattlerb/call_block_arg_named.txt
seattlerb/call_colon_parens.txt
seattlerb/call_dot_parens.txt
seattlerb/call_trailing_comma.txt
seattlerb/case_in.txt
seattlerb/case_in_else.txt
Expand Down Expand Up @@ -129,11 +127,9 @@ class RipperTest < TestCase
seattlerb/rescue_do_end_raised.txt
seattlerb/rescue_do_end_rescued.txt
seattlerb/return_call_assocs.txt
seattlerb/safe_call_dot_parens.txt
seattlerb/stabby_block_iter_call.txt
seattlerb/stabby_block_iter_call_no_target_with_arg.txt
seattlerb/str_lit_concat_bad_encodings.txt
seattlerb/thingy.txt
seattlerb/yield_call_assocs.txt
single_method_call_with_bang.txt
spanning_heredoc.txt
Expand Down Expand Up @@ -224,7 +220,6 @@ class RipperTest < TestCase
whitequark/ruby_bug_11990.txt
whitequark/ruby_bug_15789.txt
whitequark/send_block_chain_cmd.txt
whitequark/send_call.txt
whitequark/send_index_cmd.txt
whitequark/send_self.txt
whitequark/slash_newline_in_heredocs.txt
Expand Down

0 comments on commit 75e24a7

Please sign in to comment.