1 31 package org.jruby.ast; 32 33 import java.io.IOException ; 34 import java.util.List ; 35 36 import org.jruby.ast.types.INameNode; 37 import org.jruby.ast.visitor.NodeVisitor; 38 import org.jruby.evaluator.Instruction; 39 import org.jruby.lexer.yacc.ISourcePosition; 40 41 44 public class DVarNode extends Node implements INameNode { 45 static final long serialVersionUID = -8479281167248673970L; 46 47 private String name; 49 50 private int location; 53 54 public DVarNode(ISourcePosition position, int location, String name) { 55 super(position, NodeTypes.DVARNODE); 56 this.location = location; 57 this.name = name.intern(); 58 } 59 60 private void readObject(java.io.ObjectInputStream in) throws IOException , ClassNotFoundException { 61 in.defaultReadObject(); 62 63 name = name.intern(); 65 } 66 67 71 public Instruction accept(NodeVisitor iVisitor) { 72 return iVisitor.visitDVarNode(this); 73 } 74 75 80 public int getDepth() { 81 return location >> 16; 82 } 83 84 90 public int getIndex() { 91 return location & 0xffff; 92 } 93 94 95 99 public String getName() { 100 return name; 101 } 102 103 107 public void setName(String name) { 108 this.name = name; 109 } 110 111 public List childNodes() { 112 return EMPTY_LIST; 113 } 114 115 } 116 | Popular Tags |