On this page
class · Ruby 4.0
Prism::LocalVariableWriteNode
Represents writing to a local variable.
foo = 1 ^^^^^^^
Class methods 2
Instance methods 15
Attributes
Read
The number of semantic scopes we have to traverse to find the declaration of this variable.
Example
foo = 1 # depth 0 tap { foo = 1 } # depth 1
The specific rules for calculating the depth may differ from individual Ruby implementations, as they are not specified by the language. For more information, see the Prism documentation.
Read
The name of the local variable, which is an identifier.
Example
foo = :bar # name `:foo` abc = 123 # name `:abc`
Read
The value to write to the local variable. It can be any non-void expression.
foo = :bar
^^^^
abc = 1234
^^^^
Note that since the name of a local variable is known before the value is parsed, it is valid for a local variable to appear within the value of its own write.
Example
foo = foo