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
676 677 678 679 680 681 682 |
# File 'lib/yarp/node.rb', line 676 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?
673 674 675 |
# File 'lib/yarp/node.rb', line 673 def closing_loc @closing_loc end |
#locals ⇒ Object (readonly)
attr_reader locals: Array
667 668 669 |
# File 'lib/yarp/node.rb', line 667 def locals @locals end |
#opening_loc ⇒ Object (readonly)
attr_reader opening_loc: Location?
670 671 672 |
# File 'lib/yarp/node.rb', line 670 def opening_loc @opening_loc end |
#parameters ⇒ Object (readonly)
attr_reader parameters: Node?
664 665 666 |
# File 'lib/yarp/node.rb', line 664 def parameters @parameters end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
685 686 687 |
# File 'lib/yarp/node.rb', line 685 def accept(visitor) visitor.visit_block_parameters_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
691 692 693 |
# File 'lib/yarp/node.rb', line 691 def child_nodes [parameters] end |
#closing ⇒ Object
def closing: () -> String?
709 710 711 |
# File 'lib/yarp/node.rb', line 709 def closing closing_loc&.slice end |
#deconstruct_keys(keys) ⇒ Object
699 700 701 |
# File 'lib/yarp/node.rb', line 699 def deconstruct_keys(keys) { parameters: parameters, locals: locals, opening_loc: opening_loc, closing_loc: closing_loc, location: location } end |
#opening ⇒ Object
def opening: () -> String?
704 705 706 |
# File 'lib/yarp/node.rb', line 704 def opening opening_loc&.slice end |