org.jrubyparser.ast
Class DVarNode

java.lang.Object
  extended by org.jrubyparser.ast.Node
      extended by org.jrubyparser.ast.NamedNode
          extended by org.jrubyparser.ast.DVarNode
All Implemented Interfaces:
ILocalVariable, INameMatchable, INameNode, ISourcePositionHolder

public class DVarNode
extends NamedNode
implements ILocalVariable

Access a dynamic variable (e.g. block scope local variable).


Constructor Summary
DVarNode(SourcePosition position, int location, String name)
           
 
Method Summary
 Object accept(NodeVisitor iVisitor)
          Accept for the visitor pattern.
 ILocalVariable getDeclaration()
          Retrieve the node which is responsible for declaring this one.
 IScope getDefinedScope()
          Which Variable Scope does this variable belong to? Note that RootNode is a special ILocalScope for the implicit scope created at top-level.
 int getDepth()
          How many scopes should we burrow down to until we need to set the block variable value.
 int getIndex()
          Gets the index within the scope construct that actually holds the eval'd value of this local variable
 NodeType getNodeType()
           
 List<ILocalVariable> getOccurrences()
          Find all occurences of this variable including itself.
 boolean isBlockParameter()
          Is this node specifying a parameter in a block statement?
 
Methods inherited from class org.jrubyparser.ast.NamedNode
getLexicalName, getLexicalNamePosition, getName, getNamePosition, isNameMatch, isSame, setName
 
Methods inherited from class org.jrubyparser.ast.Node
adopt, adopt, adoptUsingNodesPosition, childNodes, comparePositionWith, createList, getClosestIScope, getClosestModule, getGrandParent, getInlineComment, getInnermostIter, getMethodFor, getNodeAt, getNodeName, getOutermostIter, getParent, getPosition, getPositionIncludingComments, getPreviousComments, insertAfter, insertAll, insertBefore, insertNode, isDescendentOf, isLeaf, isMethodParameter, setParent, setPosition, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jrubyparser.ast.INameNode
getLexicalName, getLexicalNamePosition, getName, getNamePosition, setName
 
Methods inherited from interface org.jrubyparser.ast.INameMatchable
isNameMatch
 

Constructor Detail

DVarNode

public DVarNode(SourcePosition position,
                int location,
                String name)
Method Detail

getNodeType

public NodeType getNodeType()
Specified by:
getNodeType in class Node
Returns:
the nodeId

accept

public Object accept(NodeVisitor iVisitor)
Accept for the visitor pattern.

Specified by:
accept in class Node
Parameters:
iVisitor - the visitor

getDepth

public int getDepth()
How many scopes should we burrow down to until we need to set the block variable value.

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

Returns:
Returns an int offset into storage structure

isBlockParameter

public boolean isBlockParameter()
Description copied from class: Node
Is this node specifying a parameter in a block statement?

Overrides:
isBlockParameter in class Node

getDefinedScope

public IScope getDefinedScope()
Description copied from interface: ILocalVariable
Which Variable Scope does this variable belong to? Note that RootNode is a special ILocalScope for the implicit scope created at top-level.

Specified by:
getDefinedScope in interface ILocalVariable

getOccurrences

public List<ILocalVariable> getOccurrences()
Description copied from interface: ILocalVariable
Find all occurences of this variable including itself.

Specified by:
getOccurrences in interface ILocalVariable

getDeclaration

public ILocalVariable getDeclaration()
Description copied from interface: ILocalVariable
Retrieve the node which is responsible for declaring this one. This can be a variable or a parameter.

Specified by:
getDeclaration in interface ILocalVariable


Copyright © 2013. All Rights Reserved.