instance method
Prism::InspectVisitor#visit_for_node
visit_for_node(node)
lib/prism/inspect_visitor.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/prism/inspect_visitor.rb, line 949
def visit_for_node(node)
commands << [inspect_node("ForNode", node), indent]
flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
commands << ["├── index:\n", indent]
commands << [node.index, "#{indent}│ "]
commands << ["├── collection:\n", indent]
commands << [node.collection, "#{indent}│ "]
if (statements = node.statements).nil?
commands << ["├── statements: ∅\n", indent]
else
commands << ["├── statements:\n", indent]
commands << [statements, "#{indent}│ "]
end
commands << ["├── for_keyword_loc: #{inspect_location(node.for_keyword_loc)}\n", indent]
commands << ["├── in_keyword_loc: #{inspect_location(node.in_keyword_loc)}\n", indent]
commands << ["├── do_keyword_loc: #{inspect_location(node.do_keyword_loc)}\n", indent]
commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent]
end
Inspect a ForNode node.