Class: YARP::BlockParametersNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::BlockParametersNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents a block’s parameters declaration.
-> (a, b = 1; local) { }
^^^^^^^^^^^^^^^^^
foo do |a, b = 1; local|
^^^^^^^^^^^^^^^^^
end
Instance Attribute Summary collapse
-
#closing_loc ⇒ Object
readonly
attr_reader closing_loc: Location?.
-
#locals ⇒ Object
readonly
attr_reader locals: Array.
-
#opening_loc ⇒ Object
readonly
attr_reader opening_loc: Location?.
-
#parameters ⇒ Object
readonly
attr_reader parameters: 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(parameters, locals, opening_loc, closing_loc, location) ⇒ BlockParametersNode
constructor
def initialize: (parameters: Node?, locals: Array, opening_loc: Location?, closing_loc: Location?, location: Location) -> void.
-
#opening ⇒ Object
def opening: () -> String?.
Constructor Details
#initialize(parameters, locals, opening_loc, closing_loc, location) ⇒ BlockParametersNode
def initialize: (parameters: Node?, locals: Array, opening_loc: Location?, closing_loc: Location?, location: Location) -> void
664 665 666 667 668 669 670 |
# File 'lib/yarp/node.rb', line 664 def initialize(parameters, locals, opening_loc, closing_loc, location) @parameters = parameters @locals = locals @opening_loc = opening_loc @closing_loc = closing_loc @location = location end |
Instance Attribute Details
#closing_loc ⇒ Object (readonly)
attr_reader closing_loc: Location?
661 662 663 |
# File 'lib/yarp/node.rb', line 661 def closing_loc @closing_loc end |
#locals ⇒ Object (readonly)
attr_reader locals: Array
655 656 657 |
# File 'lib/yarp/node.rb', line 655 def locals @locals end |
#opening_loc ⇒ Object (readonly)
attr_reader opening_loc: Location?
658 659 660 |
# File 'lib/yarp/node.rb', line 658 def opening_loc @opening_loc end |
#parameters ⇒ Object (readonly)
attr_reader parameters: Node?
652 653 654 |
# File 'lib/yarp/node.rb', line 652 def parameters @parameters end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
673 674 675 |
# File 'lib/yarp/node.rb', line 673 def accept(visitor) visitor.visit_block_parameters_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
678 679 680 |
# File 'lib/yarp/node.rb', line 678 def child_nodes [parameters] end |
#closing ⇒ Object
def closing: () -> String?
696 697 698 |
# File 'lib/yarp/node.rb', line 696 def closing closing_loc&.slice end |
#deconstruct_keys(keys) ⇒ Object
686 687 688 |
# File 'lib/yarp/node.rb', line 686 def deconstruct_keys(keys) { parameters: parameters, locals: locals, opening_loc: opening_loc, closing_loc: closing_loc, location: location } end |
#opening ⇒ Object
def opening: () -> String?
691 692 693 |
# File 'lib/yarp/node.rb', line 691 def opening opening_loc&.slice end |