class Prism::ShareableConstantNode
This node wraps a constant write to indicate that when the value is written, it should have its shareability state modified.
# shareable_constant_value: literal
C = { a: 1 }
^^^^^^^^^^^^
Public Class Methods
Source
# File lib/prism/node.rb, line 22361 def initialize(source, node_id, location, flags, write) @source = source @node_id = node_id @location = location @flags = flags @write = write end
Initialize a new ShareableConstantNode node.
Public Instance Methods
Source
# File lib/prism/node.rb, line 22459 def write @write end
The constant write that should be modified with the shareability state.
Flags
Public Instance Methods
Source
# File lib/prism/node.rb, line 22451 def experimental_copy? flags.anybits?(ShareableConstantNodeFlags::EXPERIMENTAL_COPY) end
constant writes that should be modified with shareable constant value experimental copy
Source
# File lib/prism/node.rb, line 22445 def experimental_everything? flags.anybits?(ShareableConstantNodeFlags::EXPERIMENTAL_EVERYTHING) end
constant writes that should be modified with shareable constant value experimental everything
Source
# File lib/prism/node.rb, line 22439 def literal? flags.anybits?(ShareableConstantNodeFlags::LITERAL) end
constant writes that should be modified with shareable constant value literal
Node Interface
These methods are present on all subclasses of Node. Read the node interface docs for more information.
Public Class Methods
Public Instance Methods
Source
# File lib/prism/node.rb, line 22381 def accept(visitor) visitor.visit_shareable_constant_node(self) end
See Node.accept.
Source
# File lib/prism/node.rb, line 22386 def child_nodes [write] end
See Node.child_nodes.
Source
# File lib/prism/node.rb, line 22403 def comment_targets [write] #: Array[Prism::node | Location] end
See Node.comment_targets.
Source
# File lib/prism/node.rb, line 22398 def compact_child_nodes [write] end
Source
# File lib/prism/node.rb, line 22411 def copy(node_id: self.node_id, location: self.location, flags: self.flags, write: self.write) ShareableConstantNode.new(source, node_id, location, flags, write) end
Creates a copy of self with the given fields, using self as the template.
Source
# File lib/prism/node.rb, line 22391 def each_child_node return to_enum(:each_child_node) unless block_given? yield write end
See Node.each_child_node.
Repository
Methods related to Relocation.