Class: YARP::LocalVariableWriteNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::LocalVariableWriteNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents writing to a local variable.
foo = 1
^^^^^^^
Instance Attribute Summary collapse
-
#depth ⇒ Object
readonly
attr_reader depth: Integer.
-
#name ⇒ Object
readonly
attr_reader name: Symbol.
-
#name_loc ⇒ Object
readonly
attr_reader name_loc: Location.
-
#operator_loc ⇒ Object
readonly
attr_reader operator_loc: Location.
-
#value ⇒ Object
readonly
attr_reader value: Node.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#copy(**params) ⇒ Object
def copy: (**params) -> LocalVariableWriteNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(name, depth, name_loc, value, operator_loc, location) ⇒ LocalVariableWriteNode
constructor
def initialize: (name: Symbol, depth: Integer, name_loc: Location, value: Node, operator_loc: Location, location: Location) -> void.
-
#operator ⇒ Object
def operator: () -> String.
Constructor Details
#initialize(name, depth, name_loc, value, operator_loc, location) ⇒ LocalVariableWriteNode
def initialize: (name: Symbol, depth: Integer, name_loc: Location, value: Node, operator_loc: Location, location: Location) -> void
5109 5110 5111 5112 5113 5114 5115 5116 |
# File 'lib/yarp/node.rb', line 5109 def initialize(name, depth, name_loc, value, operator_loc, location) @name = name @depth = depth @name_loc = name_loc @value = value @operator_loc = operator_loc @location = location end |
Instance Attribute Details
#depth ⇒ Object (readonly)
attr_reader depth: Integer
5097 5098 5099 |
# File 'lib/yarp/node.rb', line 5097 def depth @depth end |
#name ⇒ Object (readonly)
attr_reader name: Symbol
5094 5095 5096 |
# File 'lib/yarp/node.rb', line 5094 def name @name end |
#name_loc ⇒ Object (readonly)
attr_reader name_loc: Location
5100 5101 5102 |
# File 'lib/yarp/node.rb', line 5100 def name_loc @name_loc end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
5106 5107 5108 |
# File 'lib/yarp/node.rb', line 5106 def operator_loc @operator_loc end |
#value ⇒ Object (readonly)
attr_reader value: Node
5103 5104 5105 |
# File 'lib/yarp/node.rb', line 5103 def value @value end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
5119 5120 5121 |
# File 'lib/yarp/node.rb', line 5119 def accept(visitor) visitor.visit_local_variable_write_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
5124 5125 5126 |
# File 'lib/yarp/node.rb', line 5124 def child_nodes [value] end |
#copy(**params) ⇒ Object
def copy: (**params) -> LocalVariableWriteNode
5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 |
# File 'lib/yarp/node.rb', line 5129 def copy(**params) LocalVariableWriteNode.new( params.fetch(:name) { name }, params.fetch(:depth) { depth }, params.fetch(:name_loc) { name_loc }, params.fetch(:value) { value }, params.fetch(:operator_loc) { operator_loc }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
5144 5145 5146 |
# File 'lib/yarp/node.rb', line 5144 def deconstruct_keys(keys) { name: name, depth: depth, name_loc: name_loc, value: value, operator_loc: operator_loc, location: location } end |
#operator ⇒ Object
def operator: () -> String
5149 5150 5151 |
# File 'lib/yarp/node.rb', line 5149 def operator operator_loc.slice end |