Package org.jruby.ast

Class DVarNode

java.lang.Object
org.jruby.ast.Node
org.jruby.ast.DVarNode
All Implemented Interfaces:
IScopedNode, SideEffectFree, INameNode

public class DVarNode extends Node implements INameNode, IScopedNode, SideEffectFree
Access a dynamic variable (e.g. block scope local variable).
  • Constructor Details

    • DVarNode

      public DVarNode(int line, int location, RubySymbol name)
  • Method Details

    • getNodeType

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

      public <T> T accept(NodeVisitor<T> 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.
      Specified by:
      getDepth in interface IScopedNode
      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:
      getIndex in interface IScopedNode
      Returns:
      Returns an int offset into storage structure
    • getName

      public RubySymbol getName()
      Gets the name.
      Specified by:
      getName in interface INameNode
      Returns:
      Returns a String
    • childNodes

      public List<Node> childNodes()
      Specified by:
      childNodes in class Node
    • needsDefinitionCheck

      public boolean needsDefinitionCheck()
      Description copied from class: Node
      Check whether the given node is considered always "defined" or whether it has some form of definition check.
      Overrides:
      needsDefinitionCheck in class Node
      Returns:
      Whether the type of node represents a possibly undefined construct