Class: Prism::ShareableConstantNode
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
PrismNode
|
|
|
Instance Chain:
self,
PrismNode
|
|
| Inherits: |
PrismNode
|
| Defined in: | lib/prism/node.rb, ext/prism/api_node.c |
Overview
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 }
^^^^^^^^^^^^
Class Method Summary
-
.new(source, node_id, location, flags, write) ⇒ ShareableConstantNode
constructor
Initialize a new
ShareableConstantNodenode. -
.type
Return a symbol representation of this node type.
Instance Attribute Summary
-
#experimental_copy? ⇒ Boolean
readonly
def experimental_copy?: () -> bool.
-
#experimental_everything? ⇒ Boolean
readonly
def experimental_everything?: () -> bool.
-
#literal? ⇒ Boolean
readonly
def literal?: () -> bool.
-
#write
readonly
The constant write that should be modified with the shareability state.
Instance Method Summary
-
#===(other)
Implements case-equality for the node.
-
#accept(visitor)
def accept: (Visitor visitor) -> void.
-
#child_nodes
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#comment_targets
def comment_targets: () -> Array[Node | Location].
-
#compact_child_nodes
def compact_child_nodes: () -> Array.
-
#copy(node_id: self.node_id, location: self.location, flags: self.flags, write: self.write)
def copy: (?node_id: Integer, ?location:
Location, ?flags: Integer, ?write:ConstantWriteNode|ConstantAndWriteNode|ConstantOrWriteNode|ConstantOperatorWriteNode|ConstantPathWriteNode|ConstantPathAndWriteNode|ConstantPathOrWriteNode|ConstantPathOperatorWriteNode) ->ShareableConstantNode. -
#deconstruct
Alias for #child_nodes.
-
#deconstruct_keys(keys)
def deconstruct_keys: (Array keys) -> { node_id: Integer, location:
Location, write:ConstantWriteNode|ConstantAndWriteNode|ConstantOrWriteNode|ConstantOperatorWriteNode|ConstantPathWriteNode|ConstantPathAndWriteNode|ConstantPathOrWriteNode|ConstantPathOperatorWriteNode} -
#inspect
def inspect -> String.
-
#type
Return a symbol representation of this node type.
Constructor Details
.new(source, node_id, location, flags, write) ⇒ ShareableConstantNode
Initialize a new ShareableConstantNode node.
Class Method Details
.type
Return a symbol representation of this node type. See Node::type.
# File 'lib/prism/node.rb', line 14463
def self.type :shareable_constant_node end
Instance Attribute Details
#experimental_copy? ⇒ Boolean (readonly)
def experimental_copy?: () -> bool
# File 'lib/prism/node.rb', line 14446
def experimental_copy? flags.anybits?(ShareableConstantNodeFlags::EXPERIMENTAL_COPY) end
#experimental_everything? ⇒ Boolean (readonly)
def experimental_everything?: () -> bool
# File 'lib/prism/node.rb', line 14441
def experimental_everything? flags.anybits?(ShareableConstantNodeFlags::EXPERIMENTAL_EVERYTHING) end
#literal? ⇒ Boolean (readonly)
def literal?: () -> bool
# File 'lib/prism/node.rb', line 14436
def literal? flags.anybits?(ShareableConstantNodeFlags::LITERAL) end
#write (readonly)
The constant write that should be modified with the shareability state.
# File 'lib/prism/node.rb', line 14451
attr_reader :write
Instance Method Details
#===(other)
Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.
#accept(visitor)
def accept: (Visitor visitor) -> void
# File 'lib/prism/node.rb', line 14403
def accept(visitor) visitor.visit_shareable_constant_node(self) end
#child_nodes Also known as: #deconstruct
def child_nodes: () -> Array[nil | Node]
# File 'lib/prism/node.rb', line 14408
def child_nodes [write] end
#comment_targets
def comment_targets: () -> Array[Node | Location]
# File 'lib/prism/node.rb', line 14418
def comment_targets [write] #: Array[Prism::node | Location] end
#compact_child_nodes
def compact_child_nodes: () -> Array
# File 'lib/prism/node.rb', line 14413
def compact_child_nodes [write] end
#copy(node_id: self.node_id, location: self.location, flags: self.flags, write: self.write)
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?write: ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode) -> ShareableConstantNode
#deconstruct
Alias for #child_nodes.
# File 'lib/prism/node.rb', line 14428
alias deconstruct child_nodes
#deconstruct_keys(keys)
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, write: ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode }
# File 'lib/prism/node.rb', line 14431
def deconstruct_keys(keys) { node_id: node_id, location: location, write: write } end
#inspect
def inspect -> String
# File 'lib/prism/node.rb', line 14453
def inspect InspectVisitor.compose(self) end
#type
Return a symbol representation of this node type. See Node#type.
# File 'lib/prism/node.rb', line 14458
def type :shareable_constant_node end