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 43 public class LocalVarNode extends Node implements INameNode { 44 static final long serialVersionUID = 8562701804939317217L; 45 46 private String name; 48 49 private final int location; 52 53 public LocalVarNode(ISourcePosition position, int location, String name) { 54 super(position, NodeTypes.LOCALVARNODE); 55 this.location = location; 56 this.name = name; 57 } 58 59 63 public Instruction accept(NodeVisitor iVisitor) { 64 return iVisitor.visitLocalVarNode(this); 65 } 66 67 72 public int getDepth() { 73 return location >> 16; 74 } 75 76 82 public int getIndex() { 83 return location & 0xffff; 84 } 85 86 91 public String getName() { 92 return name; 93 } 94 95 99 public void setName(String name) { 100 this.name = name; 101 } 102 103 public List childNodes() { 104 return EMPTY_LIST; 105 } 106 107 } 108 | Popular Tags |