Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Prism::Translation::RubyParser::Compiler#visit_block_parameters_node
visit_block_parameters_node(node)
lib/prism/translation/ruby_parser.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/prism/translation/ruby_parser.rb, line 196
def visit_block_parameters_node(node)
# If this block parameters has no parameters and is using pipes, then
# it inherits its location from its shadow locals, even if they're not
# on the same lines as the pipes.
shadow_loc = true
result =
if node.parameters.nil?
s(node, :args)
else
shadow_loc = false
visit(node.parameters)
end
if node.opening == "("
result.line = node.opening_loc.start_line
result.line_max = node.closing_loc.end_line
shadow_loc = false
end
if node.locals.any?
shadow = s(node, :shadow).concat(visit_all(node.locals))
shadow.line = node.locals.first.location.start_line
shadow.line_max = node.locals.last.location.end_line
result << shadow
if shadow_loc
result.line = shadow.line
result.line_max = shadow.line_max
end
end
result
end
A block’s parameters.