1 31 package org.jruby.ast; 32 33 import java.util.List ; 34 35 import org.jruby.ast.types.INameNode; 36 import org.jruby.ast.visitor.NodeVisitor; 37 import org.jruby.evaluator.Instruction; 38 import org.jruby.lexer.yacc.ISourcePosition; 39 40 45 public class ConstDeclNode extends AssignableNode implements INameNode { 46 static final long serialVersionUID = -6260931203887158208L; 47 48 private final String name; 49 private final INameNode constNode; 50 51 public ConstDeclNode(ISourcePosition position, String name, INameNode constNode, Node valueNode) { 52 super(position, NodeTypes.CONSTDECLNODE); 53 if (name != null) name.intern(); 54 this.name = name; 55 this.constNode = constNode; 56 setValueNode(valueNode); 57 } 58 59 63 public Instruction accept(NodeVisitor iVisitor) { 64 return iVisitor.visitConstDeclNode(this); 65 } 66 67 72 public String getName() { 73 return (name == null ? constNode.getName() : name); 74 } 75 76 80 public Node getConstNode() { 81 return (Node) constNode; 82 } 83 84 public List childNodes() { 85 return createList(getValueNode()); 86 } 87 88 } 89 | Popular Tags |