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
4632 4633 4634 4635 4636 4637 |
# File 'lib/yarp/node.rb', line 4632 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
4629 4630 4631 |
# File 'lib/yarp/node.rb', line 4629 def closing_loc @closing_loc end |
#opening_loc ⇒ Object (readonly)
attr_reader opening_loc: Location
4626 4627 4628 |
# File 'lib/yarp/node.rb', line 4626 def opening_loc @opening_loc end |
#statements ⇒ Object (readonly)
attr_reader statements: Node?
4623 4624 4625 |
# File 'lib/yarp/node.rb', line 4623 def statements @statements end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
4640 4641 4642 |
# File 'lib/yarp/node.rb', line 4640 def accept(visitor) visitor.visit_parentheses_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
4649 4650 4651 |
# File 'lib/yarp/node.rb', line 4649 def child_nodes [statements] end |
#closing ⇒ Object
def closing: () -> String
4667 4668 4669 |
# File 'lib/yarp/node.rb', line 4667 def closing closing_loc.slice end |
#deconstruct_keys(keys) ⇒ Object
4657 4658 4659 |
# File 'lib/yarp/node.rb', line 4657 def deconstruct_keys(keys) { statements: statements, opening_loc: opening_loc, closing_loc: closing_loc, location: location } end |
#opening ⇒ Object
def opening: () -> String
4662 4663 4664 |
# File 'lib/yarp/node.rb', line 4662 def opening opening_loc.slice end |
#set_newline_flag(newline_marked) ⇒ Object
4644 4645 4646 |
# File 'lib/yarp/node.rb', line 4644 def set_newline_flag(newline_marked) # Never mark ParenthesesNode with a newline flag, mark children instead end |