Class: Prism::ConstantPathOperatorWriteNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::ConstantPathOperatorWriteNode
- Defined in:
- lib/prism/node.rb,
sig/generated/prism/node.rbs,
ext/prism/api_node.c
Overview
Represents assigning to a constant path using an operator that isn't =.
Parent::Child += value
^^^^^^^^^^^^^^^^^^^^^^
Class Method Summary collapse
-
.type ⇒ :constant_path_operator_write_node
See
Node.type.
Instance Method Summary collapse
-
#===(other) ⇒ boolish
: (untyped other) -> boolish.
-
#accept(visitor) ⇒ Object
See Node.accept.
-
#binary_operator ⇒ Symbol
:call-seq: binary_operator -> Symbol.
-
#binary_operator_loc ⇒ Location
:category: Locations :call-seq: binary_operator_loc -> Location.
-
#child_nodes ⇒ Array[node?]
(also: #deconstruct)
See Node.child_nodes.
-
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
-
#copy(node_id: self.node_id, location: self.location, flags: self.flags, target: self.target, binary_operator_loc: self.binary_operator_loc, value: self.value, binary_operator: self.binary_operator) ⇒ ConstantPathOperatorWriteNode
:call-seq: copy(**fields) -> ConstantPathOperatorWriteNode.
-
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped].
-
#each_child_node {|arg0| ... } ⇒ Object
See Node.each_child_node.
-
#initialize(source, node_id, location, flags, target, binary_operator_loc, value, binary_operator) ⇒ ConstantPathOperatorWriteNode
constructor
Initialize a new ConstantPathOperatorWriteNode node.
-
#inspect ⇒ String
: () -> String.
-
#save_binary_operator_loc(repository) ⇒ Relocation::Entry
:category: Repository Save the binary_operator_loc location using the given saved source so that it can be retrieved later.
-
#target ⇒ ConstantPathNode
:call-seq: target -> ConstantPathNode.
-
#type ⇒ :constant_path_operator_write_node
See
Node#type. -
#value ⇒ Prism::node
:call-seq: value -> Node.
Constructor Details
#initialize(source, node_id, location, flags, target, binary_operator_loc, value, binary_operator) ⇒ ConstantPathOperatorWriteNode
Initialize a new ConstantPathOperatorWriteNode node.
: (Source source, Integer node_id, Location location, Integer flags, ConstantPathNode target, Location binary_operator_loc, Prism::node value, Symbol binary_operator) -> void
9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 |
# File 'lib/prism/node.rb', line 9446 def initialize(source, node_id, location, flags, target, binary_operator_loc, value, binary_operator) @source = source @node_id = node_id @location = location @flags = flags @target = target @binary_operator_loc = binary_operator_loc @value = value @binary_operator = binary_operator end |
Class Method Details
.type ⇒ :constant_path_operator_write_node
See Node.type.
: () -> :constant_path_operator_write_node
9538 9539 9540 |
# File 'lib/prism/node.rb', line 9538 def self.type :constant_path_operator_write_node end |
Instance Method Details
#===(other) ⇒ boolish
: (untyped other) -> boolish
9606 9607 9608 9609 9610 9611 9612 |
# File 'lib/prism/node.rb', line 9606 def ===(other) # :nodoc: other.is_a?(ConstantPathOperatorWriteNode) && (target === other.target) && (binary_operator_loc.nil? == other.binary_operator_loc.nil?) && (value === other.value) && (binary_operator === other.binary_operator) end |
#accept(visitor) ⇒ Object
See Node.accept.
: (_Visitor visitor) -> untyped
9471 9472 9473 |
# File 'lib/prism/node.rb', line 9471 def accept(visitor) visitor.visit_constant_path_operator_write_node(self) end |
#binary_operator ⇒ Symbol
:call-seq:
binary_operator -> Symbol
Returns the binary_operator attribute.
: () -> Symbol
9597 9598 9599 |
# File 'lib/prism/node.rb', line 9597 def binary_operator @binary_operator end |
#binary_operator_loc ⇒ Location
:category: Locations :call-seq:
binary_operator_loc -> Location
Returns the Location represented by binary_operator_loc.
: () -> Location
9566 9567 9568 9569 9570 |
# File 'lib/prism/node.rb', line 9566 def binary_operator_loc location = @binary_operator_loc return location if location.is_a?(Location) @binary_operator_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF) end |
#child_nodes ⇒ Array[node?] Also known as: deconstruct
See Node.child_nodes.
: () -> Array
9478 9479 9480 |
# File 'lib/prism/node.rb', line 9478 def child_nodes [target, value] end |
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
: () -> Array
9496 9497 9498 |
# File 'lib/prism/node.rb', line 9496 def compact_child_nodes [target, value] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, target: self.target, binary_operator_loc: self.binary_operator_loc, value: self.value, binary_operator: self.binary_operator) ⇒ ConstantPathOperatorWriteNode
:call-seq:
copy(**fields) -> ConstantPathOperatorWriteNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?target: ConstantPathNode, ?binary_operator_loc: Location, ?value: Prism::node, ?binary_operator: Symbol) -> ConstantPathOperatorWriteNode
9506 9507 9508 |
# File 'lib/prism/node.rb', line 9506 def copy(node_id: self.node_id, location: self.location, flags: self.flags, target: self.target, binary_operator_loc: self.binary_operator_loc, value: self.value, binary_operator: self.binary_operator) ConstantPathOperatorWriteNode.new(source, node_id, location, flags, target, binary_operator_loc, value, binary_operator) end |
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 |
# File 'lib/prism/node.rb', line 9513 def deconstruct_keys(keys) # :nodoc: (keys || %i[node_id location target binary_operator_loc value binary_operator]).each_with_object( {} #: Hash[Symbol, untyped] ) do |key, deconstructed| case key when :node_id then deconstructed[:node_id] = self.node_id when :location then deconstructed[:location] = self.location when :target then deconstructed[:target] = self.target when :binary_operator_loc then deconstructed[:binary_operator_loc] = self.binary_operator_loc when :value then deconstructed[:value] = self.value when :binary_operator then deconstructed[:binary_operator] = self.binary_operator end end end |
#each_child_node ⇒ Enumerator[node, void] #each_child_node ⇒ void
See Node.each_child_node.
: () -> Enumerator[node, void] : () { (node) -> void } -> void
9486 9487 9488 9489 9490 9491 |
# File 'lib/prism/node.rb', line 9486 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? yield target yield value end |
#inspect ⇒ String
: () -> String
9543 9544 9545 |
# File 'lib/prism/node.rb', line 9543 def inspect # :nodoc: InspectVisitor.compose(self) end |
#save_binary_operator_loc(repository) ⇒ Relocation::Entry
:category: Repository Save the binary_operator_loc location using the given saved source so that it can be retrieved later.
: (_Repository repository) -> Relocation::Entry
9577 9578 9579 |
# File 'lib/prism/node.rb', line 9577 def save_binary_operator_loc(repository) repository.enter(node_id, :binary_operator_loc) end |
#target ⇒ ConstantPathNode
:call-seq:
target -> ConstantPathNode
Returns the target attribute.
: () -> ConstantPathNode
9555 9556 9557 |
# File 'lib/prism/node.rb', line 9555 def target @target end |
#type ⇒ :constant_path_operator_write_node
See Node#type.
: () -> :constant_path_operator_write_node
9531 9532 9533 |
# File 'lib/prism/node.rb', line 9531 def type :constant_path_operator_write_node end |
#value ⇒ Prism::node
:call-seq:
value -> Node
Returns the value attribute.
: () -> Prism::node
9587 9588 9589 |
# File 'lib/prism/node.rb', line 9587 def value @value end |