/** * Return a new instance of a variable for the newly cloned scope. Maps are maintained * because Variables typically share the same instance across a CFG (of the same lexical depth). * * @param variable to be renamed * @return the new Variable */ public Variable getRenamedVariable(Variable variable) { if (variable instanceof Self) return getRenamedSelfVariable(variable); Variable newVariable = variableRenameMap.get(variable); if (newVariable == null) { newVariable = getRenamedVariableSimple(variable); variableRenameMap.put(variable, newVariable); } return newVariable; } }
/** * Return a new instance of a variable for the newly cloned scope. Maps are maintained * because Variables typically share the same instance across a CFG (of the same lexical depth). * * @param variable to be renamed * @return the new Variable */ public Variable getRenamedVariable(Variable variable) { if (variable instanceof Self) return getRenamedSelfVariable(variable); Variable newVariable = variableRenameMap.get(variable); if (newVariable == null) { newVariable = getRenamedVariableSimple(variable); variableRenameMap.put(variable, newVariable); } return newVariable; } }