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 source, Integer node_id, Location location, Integer flags, (ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode) write) → void
Source
# File lib/prism/node.rb, line 28485 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
() → (ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode)
Source
# File lib/prism/node.rb, line 28611 def write @write end
The constant write that should be modified with the shareability state.
Flags
Public Instance Methods
() → bool
Source
# File lib/prism/node.rb, line 28601 def experimental_copy? flags.anybits?(ShareableConstantNodeFlags::EXPERIMENTAL_COPY) end
constant writes that should be modified with shareable constant value experimental copy
() → bool
Source
# File lib/prism/node.rb, line 28593 def experimental_everything? flags.anybits?(ShareableConstantNodeFlags::EXPERIMENTAL_EVERYTHING) end
constant writes that should be modified with shareable constant value experimental everything
() → bool
Source
# File lib/prism/node.rb, line 28585 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
(_Visitor visitor) → untyped
Source
# File lib/prism/node.rb, line 28507 def accept(visitor) visitor.visit_shareable_constant_node(self) end
See Node.accept.
() → Array[node?]
Source
# File lib/prism/node.rb, line 28514 def child_nodes [write] end
See Node.child_nodes.
() → Array[node]
Source
# File lib/prism/node.rb, line 28531 def compact_child_nodes [write] end
(?node_id: Integer, ?location: Location, ?flags: Integer, ?write: (ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode)) → ShareableConstantNode
Source
# File lib/prism/node.rb, line 28541 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.
() → Enumerator[node, void]
() { (node) → void } → void
Source
# File lib/prism/node.rb, line 28522 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.