class Prism::ShareableConstantNode
此节点包装了一个常量写入操作,以指示在写入值时,应修改其共享状态。
# shareable_constant_value: literal
C = { a: 1 }
^^^^^^^^^^^^
属性
需要通过共享状态修改的常量写入操作。
Public Class Methods
Source
# File lib/prism/node.rb, line 16445 def initialize(source, node_id, location, flags, write) @source = source @node_id = node_id @location = location @flags = flags @write = write end
初始化一个新的 ShareableConstantNode 节点。
Source
# File lib/prism/node.rb, line 16515 def self.type :shareable_constant_node end
返回此节点类型的符号表示。参见 Node::type。
Public Instance Methods
Source
# File lib/prism/node.rb, line 16521 def ===(other) other.is_a?(ShareableConstantNode) && (flags === other.flags) && (write === other.write) end
实现节点的相等性判断。这实际上是 ==,但不比较 location 的值。仅检查 location 是否存在。
Source
# File lib/prism/node.rb, line 16454 def accept(visitor) visitor.visit_shareable_constant_node(self) end
def accept: (Visitor visitor) -> void
Source
# File lib/prism/node.rb, line 16459 def child_nodes [write] end
def child_nodes: () -> Array
Source
# File lib/prism/node.rb, line 16469 def comment_targets [write] #: Array[Prism::node | Location] end
def comment_targets: () -> Array[Node | Location]
Source
# File lib/prism/node.rb, line 16464 def compact_child_nodes [write] end
def compact_child_nodes: () -> Array
Source
# File lib/prism/node.rb, line 16474 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
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?write: ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode) -> ShareableConstantNode
Source
# File lib/prism/node.rb, line 16482 def deconstruct_keys(keys) { node_id: node_id, location: location, write: write } end
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, write: ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode }
Source
# File lib/prism/node.rb, line 16497 def experimental_copy? flags.anybits?(ShareableConstantNodeFlags::EXPERIMENTAL_COPY) end
def experimental_copy?: () -> bool
Source
# File lib/prism/node.rb, line 16492 def experimental_everything? flags.anybits?(ShareableConstantNodeFlags::EXPERIMENTAL_EVERYTHING) end
def experimental_everything?: () -> bool
Source
# File lib/prism/node.rb, line 16505 def inspect InspectVisitor.compose(self) end
def inspect -> String
Source
# File lib/prism/node.rb, line 16487 def literal? flags.anybits?(ShareableConstantNodeFlags::LITERAL) end
def literal?: () -> bool