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 DAsgnNode extends AssignableNode implements INameNode { 45 static final long serialVersionUID = 2396008643154044043L; 46 47 private String name; 49 50 private int location; 53 54 public DAsgnNode(ISourcePosition position, String name, int location, Node valueNode) { 55 super(position, NodeTypes.DASGNNODE); 56 this.name = name.intern(); 57 this.location = location; 58 setValueNode(valueNode); 59 } 60 61 private void readObject(java.io.ObjectInputStream in) throws IOException , ClassNotFoundException { 62 in.defaultReadObject(); 63 64 name = name.intern(); 66 } 67 68 72 public Instruction accept(NodeVisitor iVisitor) { 73 return iVisitor.visitDAsgnNode(this); 74 } 75 76 80 public String getName() { 81 return name; 82 } 83 84 89 public int getDepth() { 90 return location >> 16; 91 } 92 93 99 public int getIndex() { 100 return location & 0xffff; 101 } 102 103 public List childNodes() { 104 return createList(getValueNode()); 105 } 106 107 public void setName(String name) { 108 this.name = name; 109 } 110 111 } 112 | Popular Tags |