org.jrubyparser.ast
Class RootNode

java.lang.Object
  extended by org.jrubyparser.ast.Node
      extended by org.jrubyparser.ast.RootNode
All Implemented Interfaces:
ILocalScope, IScope, ISourcePositionHolder

public class RootNode
extends Node
implements ILocalScope

Represents the top of the AST. This is a node not present in MRI. It was created to hold the top-most static scope in an easy to grab way and it also exists to hold BEGIN and END nodes. These can then be interpreted/compiled in the same places as the rest of the code.


Constructor Summary
RootNode(SourcePosition position, StaticScope scope, Node bodyNode)
           
 
Method Summary
 Object accept(NodeVisitor iVisitor)
           
 Node getBody()
          First real AST node to be interpreted
 Node getBodyNode()
          Deprecated. 
 NodeType getNodeType()
           
 StaticScope getStaticScope()
          The static scoping relationships that should get set first thing before interpretation of the code represented by this AST.
 List<ILocalVariable> getVariableReferencesNamed(String name)
           
 void setBody(Node body)
           
 
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, isBlockParameter, isDescendentOf, isLeaf, isMethodParameter, isSame, setParent, setPosition, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RootNode

public RootNode(SourcePosition position,
                StaticScope scope,
                Node bodyNode)
Method Detail

getNodeType

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

getStaticScope

public StaticScope getStaticScope()
The static scoping relationships that should get set first thing before interpretation of the code represented by this AST. Actually, we use getScope first since that also can contain a live dynamic scope. We rely on this method only for interpreting a root node from a serialized format.

Returns:
the top static scope for the AST

getBody

public Node getBody()
First real AST node to be interpreted

Returns:
real top AST node

getBodyNode

@Deprecated
public Node getBodyNode()
Deprecated. 


setBody

public void setBody(Node body)

accept

public Object accept(NodeVisitor iVisitor)
Specified by:
accept in class Node

getVariableReferencesNamed

public List<ILocalVariable> getVariableReferencesNamed(String name)
Specified by:
getVariableReferencesNamed in interface IScope


Copyright © 2013. All Rights Reserved.