org.jruby.ast
Class LocalVarNode

java.lang.Object
  extended by org.jruby.ast.Node
      extended by org.jruby.ast.LocalVarNode
All Implemented Interfaces:
INameNode, ISourcePositionHolder

public class LocalVarNode
extends Node
implements INameNode

Access a local variable


Field Summary
 
Fields inherited from class org.jruby.ast.Node
EMPTY_COMMENT_LIST, INVALID_POSITION, nodeId
 
Constructor Summary
LocalVarNode(ISourcePosition position, int location, java.lang.String name)
           
 
Method Summary
 Instruction accept(NodeVisitor iVisitor)
          Accept for the visitor pattern.
 java.util.List<Node> childNodes()
           
 java.lang.String definition(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock)
           
 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
 java.lang.String getName()
          What is the name of this variable
 IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock)
           
 void setName(java.lang.String name)
          Set the name of this variable (for refactoring support)
 
Methods inherited from class org.jruby.ast.Node
addComment, addComments, assign, createList, getComments, getNodeName, getPosition, getPositionIncludingComments, hasComments, isInvisible, setPosition, toString, when
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalVarNode

public LocalVarNode(ISourcePosition position,
                    int location,
                    java.lang.String name)
Method Detail

accept

public Instruction 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

getName

public java.lang.String getName()
What is the name of this variable

Specified by:
getName in interface INameNode
Returns:
the name of the variable

setName

public void setName(java.lang.String name)
Set the name of this variable (for refactoring support)

Parameters:
name - the new name

childNodes

public java.util.List<Node> childNodes()
Specified by:
childNodes in class Node

interpret

public IRubyObject interpret(Ruby runtime,
                             ThreadContext context,
                             IRubyObject self,
                             Block aBlock)
Overrides:
interpret in class Node

definition

public java.lang.String definition(Ruby runtime,
                                   ThreadContext context,
                                   IRubyObject self,
                                   Block aBlock)
Overrides:
definition in class Node


Copyright © 2002-2007 JRuby Team. All Rights Reserved.