org.jruby.ast
Class RootNode
java.lang.Object
org.jruby.ast.Node
org.jruby.ast.RootNode
- All Implemented Interfaces:
- ISourcePositionHolder
public class RootNode
- extends Node
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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
RootNode
public RootNode(ISourcePosition position,
DynamicScope scope,
Node bodyNode)
getNodeType
public NodeType getNodeType()
- Specified by:
getNodeType
in class Node
- Returns:
- the nodeId
getScope
public DynamicScope getScope()
- Return the dynamic scope for this AST. The variable backed by this is transient so
for serialization this is null. In that case we use staticScope to rebuild the dynamic
scope. The real reason for this method is supporting bindings+eval. We need to pass
our live dynamic scope in so when we eval we can use that dynamic scope.
- Returns:
- dynamic scope of this AST
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
getBodyNode
public Node getBodyNode()
- First real AST node to be interpreted
- Returns:
- real top AST node
accept
public java.lang.Object accept(NodeVisitor iVisitor)
- Specified by:
accept
in class Node
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
Copyright © 2002-2009 JRuby Team. All Rights Reserved.