Class: Prism::BlockLocalVariableNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::BlockLocalVariableNode
- Defined in:
- lib/prism/node.rb,
ext/prism/api_node.c
Overview
Represents a block local variable.
a { |; b| }
^
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
attr_reader name: Symbol.
Class Method Summary collapse
-
.type ⇒ Object
Return a symbol representation of this node type.
Instance Method Summary collapse
-
#===(other) ⇒ Object
Implements case-equality for the node.
-
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location].
-
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array.
-
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> BlockLocalVariableNode.
-
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, name: Symbol }.
-
#initialize(source, node_id, location, flags, name) ⇒ BlockLocalVariableNode
constructor
Initialize a new BlockLocalVariableNode node.
-
#inspect ⇒ Object
def inspect -> String.
-
#repeated_parameter? ⇒ Boolean
def repeated_parameter?: () -> bool.
-
#type ⇒ Object
Return a symbol representation of this node type.
Constructor Details
#initialize(source, node_id, location, flags, name) ⇒ BlockLocalVariableNode
Initialize a new BlockLocalVariableNode node.
1500 1501 1502 1503 1504 1505 1506 |
# File 'lib/prism/node.rb', line 1500 def initialize(source, node_id, location, flags, name) @source = source @node_id = node_id @location = location @flags = flags @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
attr_reader name: Symbol
1547 1548 1549 |
# File 'lib/prism/node.rb', line 1547 def name @name end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
1560 1561 1562 |
# File 'lib/prism/node.rb', line 1560 def self.type :block_local_variable_node end |
Instance Method Details
#===(other) ⇒ Object
Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.
1566 1567 1568 1569 1570 |
# File 'lib/prism/node.rb', line 1566 def ===(other) other.is_a?(BlockLocalVariableNode) && (flags === other.flags) && (name === other.name) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
1509 1510 1511 |
# File 'lib/prism/node.rb', line 1509 def accept(visitor) visitor.visit_block_local_variable_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
1514 1515 1516 |
# File 'lib/prism/node.rb', line 1514 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
1524 1525 1526 |
# File 'lib/prism/node.rb', line 1524 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
1519 1520 1521 |
# File 'lib/prism/node.rb', line 1519 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> BlockLocalVariableNode
1529 1530 1531 |
# File 'lib/prism/node.rb', line 1529 def copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) BlockLocalVariableNode.new(source, node_id, location, flags, name) end |
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, name: Symbol }
1537 1538 1539 |
# File 'lib/prism/node.rb', line 1537 def deconstruct_keys(keys) { node_id: node_id, location: location, name: name } end |
#inspect ⇒ Object
def inspect -> String
1550 1551 1552 |
# File 'lib/prism/node.rb', line 1550 def inspect InspectVisitor.compose(self) end |
#repeated_parameter? ⇒ Boolean
def repeated_parameter?: () -> bool
1542 1543 1544 |
# File 'lib/prism/node.rb', line 1542 def repeated_parameter? flags.anybits?(ParameterFlags::REPEATED_PARAMETER) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
1555 1556 1557 |
# File 'lib/prism/node.rb', line 1555 def type :block_local_variable_node end |