instance method
Prism::Translation::RubyParser::Compiler#visit_module_node
visit_module_node(node)
lib/prism/translation/ruby_parser.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/prism/translation/ruby_parser.rb, line 1276
def visit_module_node(node)
name =
if node.constant_path.is_a?(ConstantReadNode)
node.name
else
visit(node.constant_path)
end
result =
if node.body.nil?
s(node, :module, name)
elsif node.body.is_a?(StatementsNode)
compiler = copy_compiler(in_def: false)
s(node, :module, name).concat(node.body.body.map { |child| child.accept(compiler) })
else
s(node, :module, name, node.body.accept(copy_compiler(in_def: false)))
end
attach_comments(result, node)
result
end
module Foo; end ^^^^^^^^^^^^^^^