instance method
Prism::InspectVisitor#visit_if_node
visit_if_node(node)
lib/prism/inspect_visitor.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/prism/inspect_visitor.rb, line 1110
def visit_if_node(node)
commands << [inspect_node("IfNode", node), indent]
flags = [("newline" if node.newline?), ("static_literal" if node.static_literal?), ].compact
commands << ["├── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n", indent]
commands << ["├── if_keyword_loc: #{inspect_location(node.if_keyword_loc)}\n", indent]
commands << ["├── predicate:\n", indent]
commands << [node.predicate, "#{indent}│ "]
commands << ["├── then_keyword_loc: #{inspect_location(node.then_keyword_loc)}\n", indent]
if (statements = node.statements).nil?
commands << ["├── statements: ∅\n", indent]
else
commands << ["├── statements:\n", indent]
commands << [statements, "#{indent}│ "]
end
if (subsequent = node.subsequent).nil?
commands << ["├── subsequent: ∅\n", indent]
else
commands << ["├── subsequent:\n", indent]
commands << [subsequent, "#{indent}│ "]
end
commands << ["└── end_keyword_loc: #{inspect_location(node.end_keyword_loc)}\n", indent]
end
Inspect a IfNode node.
See also
#visit_hash_pattern_node
#visit_imaginary_node
#visit_hash_node
#visit_implicit_node
also in
3.4