1 28 package org.jruby.ast; 29 30 import java.util.List ; 31 32 import org.jruby.ast.visitor.NodeVisitor; 33 import org.jruby.evaluator.Instruction; 34 import org.jruby.lexer.yacc.ISourcePosition; 35 import org.jruby.parser.StaticScope; 36 import org.jruby.runtime.DynamicScope; 37 38 45 public class RootNode extends Node { 48 private static final long serialVersionUID = 1754281364026417051L; 49 50 private transient DynamicScope scope; 51 private StaticScope staticScope; 52 private Node bodyNode; 53 54 public RootNode(ISourcePosition position, DynamicScope scope, Node bodyNode) { 55 super(position, NodeTypes.ROOTNODE); 56 57 this.scope = scope; 58 this.staticScope = scope.getStaticScope(); 59 this.bodyNode = bodyNode; 60 } 61 62 70 public DynamicScope getScope() { 71 return scope; 72 } 73 74 82 public StaticScope getStaticScope() { 83 return staticScope; 84 } 85 86 91 public Node getBodyNode() { 92 return bodyNode; 93 } 94 95 public Instruction accept(NodeVisitor iVisitor) { 96 return iVisitor.visitRootNode(this); 97 } 98 99 public List childNodes() { 100 return createList(bodyNode); 101 } 102 103 } 104 | Popular Tags |