Represents writing to a constant.

Foo = 1
^^^^^^^
Attributes
Read

The name of the constant.

Foo = :bar # name `:Foo`

XYZ = 1    # name `:XYZ`
Read

The value to write to the constant. It can be any non-void expression.

FOO = :bar
      ^^^^

MyClass = Class.new
          ^^^^^^^^^
Class Methods

Initialize a new ConstantWriteNode node.

Return a symbol representation of this node type. See Node::type.

Instance Methods

Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.

def accept: (Visitor visitor) -> void

def child_nodes: () -> Array

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

def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol, ?name_loc: Location, ?value: Prism::node, ?operator_loc: Location) -> ConstantWriteNode

def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, name: Symbol, name_loc: Location, value: Prism::node, operator_loc: Location }

Returns the full name of this constant. For example: “Foo”

Returns the list of parts for the full name of this constant. For example: [:Foo]

def inspect -> String

The location of the constant name.

FOO = 1
^^^

def operator: () -> String

The location of the = operator.

FOO = :bar
    ^

Save the name_loc location using the given saved source so that it can be retrieved later.

Save the operator_loc location using the given saved source so that it can be retrieved later.

Return a symbol representation of this node type. See Node#type.