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 27835 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 27960 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 27950 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 27942 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 27934 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 27857 def accept(visitor) visitor.visit_shareable_constant_node(self) end
See Node.accept.
Source
# File lib/prism/node.rb, line 27864 def child_nodes [write] end
See Node.child_nodes.
Source
# File lib/prism/node.rb, line 27888 def comment_targets [write] #: Array[Prism::node | Location] end
See Node.comment_targets.
Source
# File lib/prism/node.rb, line 27881 def compact_child_nodes [write] end
Source
# File lib/prism/node.rb, line 27898 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 27872 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? yield write end
See Node.each_child_node.
Repository
Methods related to Relocation.