1 28 29 package org.jruby.ast.visitor.rewriter.utils; 30 31 import java.util.HashMap ; 32 33 import org.jruby.parser.StaticScope; 34 35 public class LocalVariables { 36 37 private final HashMap localVariablesMap = new HashMap (); 38 39 public void addLocalVariable(int count, String name) { 40 localVariablesMap.put(new Integer (count), name); 41 } 42 43 public void addLocalVariable(StaticScope scope) { 44 for (int i = 0; i < scope.getVariables().length; i++) { 45 addLocalVariable(i, scope.getVariables()[i]); 46 } 47 } 48 49 public String getLocalVariable(int index) { 50 return (String ) localVariablesMap.get(new Integer (index)); 51 } 52 } 53 | Popular Tags |