Class Nodes.LocalVariableWriteNode
java.lang.Object
org.prism.Nodes.Node
org.prism.Nodes.LocalVariableWriteNode
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal intThe number of semantic scopes we have to traverse to find the declaration of this variable.final org.jruby.RubySymbolThe name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers).final Nodes.NodeThe value to write to the local variable.Fields inherited from class org.prism.Nodes.Node
EMPTY_ARRAY, length, startOffset -
Constructor Summary
ConstructorsConstructorDescriptionLocalVariableWriteNode(int startOffset, int length, org.jruby.RubySymbol name, int depth, Nodes.Node value) -
Method Summary
Modifier and TypeMethodDescription<T> Taccept(AbstractNodeVisitor<T> visitor) protected String<T> voidvisitChildNodes(AbstractNodeVisitor<T> visitor) Methods inherited from class org.prism.Nodes.Node
endOffset, hasNewLineFlag, setNewLineFlag, setNewLineFlag, toString
-
Field Details
-
name
public final org.jruby.RubySymbol nameThe name of the local variable, which is an [identifier](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#identifiers). foo = :bar # name `:foo` abc = 123 # name `:abc` -
depth
public final int depthThe number of semantic scopes we have to traverse to find the declaration of this variable. 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](https://github.com/ruby/prism/blob/main/docs/local_variable_depth.md). -
value
The value to write to the local variable. It can be any [non-void expression](https://github.com/ruby/prism/blob/main/docs/parsing_rules.md#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. foo = foo
-
-
Constructor Details
-
LocalVariableWriteNode
public LocalVariableWriteNode(int startOffset, int length, org.jruby.RubySymbol name, int depth, Nodes.Node value)
-
-
Method Details
-
visitChildNodes
- Specified by:
visitChildNodesin classNodes.Node
-
childNodes
- Specified by:
childNodesin classNodes.Node
-
accept
- Specified by:
acceptin classNodes.Node
-
toString
- Specified by:
toStringin classNodes.Node
-