From 75e24a74d984598aabccff6a6dabc35a3e67cd5a Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Tue, 5 Mar 2024 21:52:54 -0500 Subject: [PATCH] [ruby/prism] Implement call shorthand for ripper translation https://github.com/ruby/prism/commit/4d08736bd5 --- lib/prism/translation/ripper.rb | 9 +++++++-- test/prism/ripper_test.rb | 5 ----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/prism/translation/ripper.rb b/lib/prism/translation/ripper.rb index 0c81e37fe7..9999e9261f 100644 --- a/lib/prism/translation/ripper.rb +++ b/lib/prism/translation/ripper.rb @@ -646,8 +646,13 @@ module Prism 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) diff --git a/test/prism/ripper_test.rb b/test/prism/ripper_test.rb index a620a97919..14512a9469 100644 --- a/test/prism/ripper_test.rb +++ b/test/prism/ripper_test.rb @@ -55,8 +55,6 @@ module Prism 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 @@ -129,11 +127,9 @@ module Prism 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 @@ -224,7 +220,6 @@ module Prism 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