1 32 package org.jruby.ast; 33 34 import java.io.IOException ; 35 import java.util.List ; 36 37 import org.jruby.ast.types.INameNode; 38 import org.jruby.ast.visitor.NodeVisitor; 39 import org.jruby.evaluator.Instruction; 40 import org.jruby.lexer.yacc.ISourcePosition; 41 42 45 public class LocalAsgnNode extends AssignableNode implements INameNode { 46 static final long serialVersionUID = 1118108700098164006L; 47 48 private String name; 50 51 private final int location; 54 55 public LocalAsgnNode(ISourcePosition position, String name, int location, Node valueNode) { 56 super(position, NodeTypes.LOCALASGNNODE); 57 this.name = name.intern(); 58 this.location = location; 59 setValueNode(valueNode); 60 } 61 62 private void readObject(java.io.ObjectInputStream in) throws IOException , ClassNotFoundException { 63 in.defaultReadObject(); 64 65 name = name.intern(); 67 } 68 69 73 public Instruction accept(NodeVisitor iVisitor) { 74 return iVisitor.visitLocalAsgnNode(this); 75 } 76 77 80 public String getName() { 81 return name; 82 } 83 84 88 public void setName(String name) { 89 this.name = name; 90 } 91 92 97 public int getDepth() { 98 return location >> 16; 99 } 100 101 107 public int getIndex() { 108 return location & 0xffff; 109 } 110 111 public List childNodes() { 112 return createList(getValueNode()); 113 } 114 115 } 116 | Popular Tags |