diff options
author | Kevin Newton <kddnewton@gmail.com> | 2024-03-05 23:49:11 -0500 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2024-03-06 16:42:57 +0000 |
commit | 2a051b0140e538b20b38b2e23222de22dd588c05 (patch) | |
tree | 40c94f92867c88df44d7b2b0a0763cc715a12484 /lib/prism/translation/ripper.rb | |
parent | 4304f5b6fb12a8888e7cd672105f564502f18c84 (diff) |
[ruby/prism] Share argument handling in super nodes in ripper translation
https://github.com/ruby/prism/commit/f315bdb45d
Diffstat (limited to 'lib/prism/translation/ripper.rb')
-rw-r--r-- | lib/prism/translation/ripper.rb | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/lib/prism/translation/ripper.rb b/lib/prism/translation/ripper.rb index a3af606f3b..bb5b2c6003 100644 --- a/lib/prism/translation/ripper.rb +++ b/lib/prism/translation/ripper.rb @@ -2467,39 +2467,21 @@ module Prism # super(foo) # ^^^^^^^^^^ def visit_super_node(node) - arguments = node.arguments&.arguments || [] - block = node.block - - if node.block.is_a?(BlockArgumentNode) - arguments << block - block = nil - end - - arguments = - if arguments.any? - args = visit_arguments(arguments) - - if node.block.is_a?(BlockArgumentNode) - args - else - bounds(arguments.first.location) - on_args_add_block(args, false) - end - end + arguments, block = visit_call_node_arguments(node.arguments, node.block) if !node.lparen_loc.nil? bounds(node.lparen_loc) arguments = on_arg_paren(arguments) end + bounds(node.location) + call = on_super(arguments) + if block.nil? - bounds(node.location) - on_super(arguments) + call else - block = visit(block) - - bounds(node.location) - on_method_add_block(on_super(arguments), block) + bounds(node.block.location) + on_method_add_block(call, block) end end |