Package org.jruby.ast
Class LocalVarNode
java.lang.Object
org.jruby.ast.Node
org.jruby.ast.LocalVarNode
- All Implemented Interfaces:
IScopedNode,SideEffectFree,INameNode
Access a local variable
-
Field Summary
Fields inherited from class org.jruby.ast.Node
containsVariableAssignment, newline -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Taccept(NodeVisitor<T> iVisitor) Accept for the visitor pattern.intgetDepth()How many scopes should we burrow down to until we need to set the block variable value.intgetIndex()Gets the index within the scope construct that actually holds the eval'd value of this local variablegetName()What is the name of this variablebooleanCheck whether the given node is considered always "defined" or whether it has some form of definition check.Methods inherited from class org.jruby.ast.Node
containsVariableAssignment, createList, createList, createList, createList, executesOnce, getFile, getLine, getNodeName, isNewline, isNil, setLine, setNewline, toString, toString, toStringExtraInfo, toStringInternal, unsetNewline
-
Constructor Details
-
LocalVarNode
-
-
Method Details
-
getNodeType
- Specified by:
getNodeTypein classNode- Returns:
- the nodeId
-
accept
Accept for the visitor pattern. -
getDepth
public int getDepth()How many scopes should we burrow down to until we need to set the block variable value.- Specified by:
getDepthin interfaceIScopedNode- Returns:
- 0 for current scope, 1 for one down, ...
-
getIndex
public int getIndex()Gets the index within the scope construct that actually holds the eval'd value of this local variable- Specified by:
getIndexin interfaceIScopedNode- Returns:
- Returns an int offset into storage structure
-
getName
What is the name of this variable -
childNodes
- Specified by:
childNodesin classNode
-
needsDefinitionCheck
public boolean needsDefinitionCheck()Description copied from class:NodeCheck whether the given node is considered always "defined" or whether it has some form of definition check.- Overrides:
needsDefinitionCheckin classNode- Returns:
- Whether the type of node represents a possibly undefined construct
-