class Prism::ShareableConstantNode
这个节点包装了一个常量写入,以指示当写入值时,应修改其可共享性状态。
# shareable_constant_value: literal C = { a: 1 } ^^^^^^^^^^^^
属性
应使用可共享性状态修改的常量写入。
公共类方法
初始化一个新的 ShareableConstantNode
节点。
# File prism/node.rb, line 16205 def initialize(source, node_id, location, flags, write) @source = source @node_id = node_id @location = location @flags = flags @write = write end
返回此节点类型的符号表示形式。请参阅 ‘Node::type`。
# File prism/node.rb, line 16275 def self.type :shareable_constant_node end
公共实例方法
为节点实现 case-equality。这实际上是 ==,但不比较位置的值。位置仅检查是否存在。
# File prism/node.rb, line 16281 def ===(other) other.is_a?(ShareableConstantNode) && (flags === other.flags) && (write === other.write) end
def accept: (Visitor
visitor) -> void
# File prism/node.rb, line 16214 def accept(visitor) visitor.visit_shareable_constant_node(self) end
def child_nodes
: () -> Array[nil | Node]
# File prism/node.rb, line 16219 def child_nodes [write] end
def comment_targets
: () -> Array[Node | Location]
# File prism/node.rb, line 16229 def comment_targets [write] #: Array[Prism::node | Location] end
def compact_child_nodes
: () -> Array
# File prism/node.rb, line 16224 def compact_child_nodes [write] end
def copy: (?node_id: Integer, ?location: Location
, ?flags: Integer, ?write: ConstantWriteNode
| ConstantAndWriteNode
| ConstantOrWriteNode
| ConstantOperatorWriteNode
| ConstantPathWriteNode
| ConstantPathAndWriteNode
| ConstantPathOrWriteNode
| ConstantPathOperatorWriteNode
) -> ShareableConstantNode
# File prism/node.rb, line 16234 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 deconstruct_keys
: (Array keys) -> { node_id: Integer, location: Location
, write: ConstantWriteNode
| ConstantAndWriteNode
| ConstantOrWriteNode
| ConstantOperatorWriteNode
| ConstantPathWriteNode
| ConstantPathAndWriteNode
| ConstantPathOrWriteNode
| ConstantPathOperatorWriteNode
}
# File prism/node.rb, line 16242 def deconstruct_keys(keys) { node_id: node_id, location: location, write: write } end
def experimental_copy?: () -> bool
# File prism/node.rb, line 16257 def experimental_copy? flags.anybits?(ShareableConstantNodeFlags::EXPERIMENTAL_COPY) end
def experimental_everything?: () -> bool
# File prism/node.rb, line 16252 def experimental_everything? flags.anybits?(ShareableConstantNodeFlags::EXPERIMENTAL_EVERYTHING) end
def inspect -> String
# File prism/node.rb, line 16265 def inspect InspectVisitor.compose(self) end
def literal?: () -> bool
# File prism/node.rb, line 16247 def literal? flags.anybits?(ShareableConstantNodeFlags::LITERAL) end
返回此节点类型的符号表示形式。请参阅 ‘Node#type`。
# File prism/node.rb, line 16270 def type :shareable_constant_node end