Class: YARP::ParenthesesNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ParenthesesNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents a parenthesized expression
(10 + 34)
^^^^^^^^^
Instance Attribute Summary collapse
-
#closing_loc ⇒ Object
readonly
attr_reader closing_loc: Location.
-
#opening_loc ⇒ Object
readonly
attr_reader opening_loc: Location.
-
#statements ⇒ Object
readonly
attr_reader statements: Node?.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#closing ⇒ Object
def closing: () -> String.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(statements, opening_loc, closing_loc, location) ⇒ ParenthesesNode
constructor
def initialize: (statements: Node?, opening_loc: Location, closing_loc: Location, location: Location) -> void.
-
#opening ⇒ Object
def opening: () -> String.
- #set_newline_flag(newline_marked) ⇒ Object
Constructor Details
#initialize(statements, opening_loc, closing_loc, location) ⇒ ParenthesesNode
def initialize: (statements: Node?, opening_loc: Location, closing_loc: Location, location: Location) -> void
4612 4613 4614 4615 4616 4617 |
# File 'lib/yarp/node.rb', line 4612 def initialize(statements, opening_loc, closing_loc, location) @statements = statements @opening_loc = opening_loc @closing_loc = closing_loc @location = location end |
Instance Attribute Details
#closing_loc ⇒ Object (readonly)
attr_reader closing_loc: Location
4609 4610 4611 |
# File 'lib/yarp/node.rb', line 4609 def closing_loc @closing_loc end |
#opening_loc ⇒ Object (readonly)
attr_reader opening_loc: Location
4606 4607 4608 |
# File 'lib/yarp/node.rb', line 4606 def opening_loc @opening_loc end |
#statements ⇒ Object (readonly)
attr_reader statements: Node?
4603 4604 4605 |
# File 'lib/yarp/node.rb', line 4603 def statements @statements end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
4620 4621 4622 |
# File 'lib/yarp/node.rb', line 4620 def accept(visitor) visitor.visit_parentheses_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
4629 4630 4631 |
# File 'lib/yarp/node.rb', line 4629 def child_nodes [statements] end |
#closing ⇒ Object
def closing: () -> String
4647 4648 4649 |
# File 'lib/yarp/node.rb', line 4647 def closing closing_loc.slice end |
#deconstruct_keys(keys) ⇒ Object
4637 4638 4639 |
# File 'lib/yarp/node.rb', line 4637 def deconstruct_keys(keys) { statements: statements, opening_loc: opening_loc, closing_loc: closing_loc, location: location } end |
#opening ⇒ Object
def opening: () -> String
4642 4643 4644 |
# File 'lib/yarp/node.rb', line 4642 def opening opening_loc.slice end |
#set_newline_flag(newline_marked) ⇒ Object
4624 4625 4626 |
# File 'lib/yarp/node.rb', line 4624 def set_newline_flag(newline_marked) # Never mark ParenthesesNode with a newline flag, mark children instead end |