class Prism::ShareableConstantNode
Этот узел оборачивает запись константы, указывая, что при записи значения следует изменить его состояние доступности для совместного использования.
# shareable_constant_value: literal
C = { a: 1 }
^^^^^^^^^^^^ Атрибуты
Запись константы, состояние доступности для совместного использования которой следует изменить.
Общедоступные методы класса
# File lib/prism/node.rb, line 16408 def initialize(source, node_id, location, flags, write) @source = source @node_id = node_id @location = location @flags = flags @write = write end
Инициализирует новый узел ShareableConstantNode.
# File lib/prism/node.rb, line 16478 def self.type :shareable_constant_node end
Возвращает символьное представление типа этого узла. См. Node::type.
Общедоступные методы экземпляра
# File lib/prism/node.rb, line 16484
def ===(other)
other.is_a?(ShareableConstantNode) &&
(flags === other.flags) &&
(write === other.write)
end Реализует проверку равенства с учётом case для узла. По сути, это ==, но без сравнения значений расположений. Проверяется только наличие расположений.
# File lib/prism/node.rb, line 16417 def accept(visitor) visitor.visit_shareable_constant_node(self) end
def accept: (Visitor visitor) -> void
# File lib/prism/node.rb, line 16422 def child_nodes [write] end
def child_nodes: () -> Array
# File lib/prism/node.rb, line 16432 def comment_targets [write] #: Array[Prism::node | Location] end
def comment_targets: () -> Array[Node | Location]
# File lib/prism/node.rb, line 16427 def compact_child_nodes [write] end
def compact_child_nodes: () -> Array
# File lib/prism/node.rb, line 16437 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
# File lib/prism/node.rb, line 16445
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 }
# File lib/prism/node.rb, line 16460 def experimental_copy? flags.anybits?(ShareableConstantNodeFlags::EXPERIMENTAL_COPY) end
def experimental_copy?: () -> bool
# File lib/prism/node.rb, line 16455 def experimental_everything? flags.anybits?(ShareableConstantNodeFlags::EXPERIMENTAL_EVERYTHING) end
def experimental_everything?: () -> bool
# File lib/prism/node.rb, line 16468 def inspect InspectVisitor.compose(self) end
def inspect -> String
# File lib/prism/node.rb, line 16450 def literal? flags.anybits?(ShareableConstantNodeFlags::LITERAL) end
def literal?: () -> bool
# File lib/prism/node.rb, line 16473 def type :shareable_constant_node end
Возвращает символьное представление типа этого узла. См. Node#type.
Ruby Core © 1993–2025 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.