Spec-Zone.ru › Ruby 3.4

класс Prism::ShareableConstantNode

Родитель:
Prism::Node

Этот узел оборачивает запись константы, чтобы указать, что при записи значения должен быть изменён его статус совместного использования.

# shareable_constant_value: literal
C = { a: 1 }
^^^^^^^^^^^^

Атрибуты

write [R]

Константа write, которая должна быть изменена в соответствии с состоянием совместного использования.

Методы публичного класса

new (source, node_id, location, flags, write)
Исходный код
# File lib/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

Инициализировать новый узел ShareableConstantNode.

type ()
Исходный код
# File lib/prism/node.rb, line 16275
def self.type
  :shareable_constant_node
end

Возвращает символьное представление типа этого узла. См. ‘Node::type’.

Методы публичного экземпляра

=== (other)
Исходный код
# File lib/prism/node.rb, line 16281
def ===(other)
  other.is_a?(ShareableConstantNode) &&
    (flags === other.flags) &&
    (write === other.write)
end

Реализует проверку равенства для узла. Это по сути ==, но без сравнения значений локаций. Локации проверяются только на наличие.

accept (visitor)
Исходный код
# File lib/prism/node.rb, line 16214
def accept(visitor)
  visitor.visit_shareable_constant_node(self)
end

def accept: (Visitor visitor) -> void

child_nodes ()
Исходный код
# File lib/prism/node.rb, line 16219
def child_nodes
  [write]
end

def child_nodes: () -> Array[nil | Node]

Также переименовано в: deconstruct
comment_targets ()
Исходный код
# File lib/prism/node.rb, line 16229
def comment_targets
  [write] #: Array[Prism::node | Location]
end

def comment_targets: () -> Array[Node | Location]

compact_child_nodes ()
Исходный код
# File lib/prism/node.rb, line 16224
def compact_child_nodes
  [write]
end

def compact_child_nodes: () -> Array

copy (node_id: self.node_id, location: self.location, flags: self.flags, write: self.write)
Исходный код
# File lib/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 copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?write: ConstantWriteNode | ConstantAndWriteNode | ConstantOrWriteNode | ConstantOperatorWriteNode | ConstantPathWriteNode | ConstantPathAndWriteNode | ConstantPathOrWriteNode | ConstantPathOperatorWriteNode) -> ShareableConstantNode

deconstruct ()

def deconstruct: () -> Array[nil | Node]

Псевдоним для: child_nodes
deconstruct_keys (keys)
Исходный код
# File lib/prism/node.rb, line 16242
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 }

experimental_copy? ()
Исходный код
# File lib/prism/node.rb, line 16257
def experimental_copy?
  flags.anybits?(ShareableConstantNodeFlags::EXPERIMENTAL_COPY)
end

def experimental_copy?: () -> bool

experimental_everything? ()
Исходный код
# File lib/prism/node.rb, line 16252
def experimental_everything?
  flags.anybits?(ShareableConstantNodeFlags::EXPERIMENTAL_EVERYTHING)
end

def experimental_everything?: () -> bool

inspect ()
Исходный код
# File lib/prism/node.rb, line 16265
def inspect
  InspectVisitor.compose(self)
end

def inspect -> String

literal? ()
Исходный код
# File lib/prism/node.rb, line 16247
def literal?
  flags.anybits?(ShareableConstantNodeFlags::LITERAL)
end

def literal?: () -> bool

type ()
Исходный код
# File lib/prism/node.rb, line 16270
def type
  :shareable_constant_node
end

Возвращает символьное представление типа этого узла. См. ‘Node#type’.

Ruby Core © 1993–2024 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API