 -            Preconditions.checkState(n.getType() == Token.NAME);
 -            n.setString(newName);
 -          }
--          compiler.reportCodeChange();
--        }
--        nameMap.remove(name);
--      }
--    }
--
--    @Override
--    public boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {
--      return true;
--    }
--
--    @Override
--    public void visit(NodeTraversal t, Node node, Node parent) {
--      if (t.inGlobalScope()) {
--        return;
--      }
 +              Node parentNode = var.getParentNode();
 +              if (parentNode.getType() == Token.FUNCTION &&
 +                  parentNode == var.scope.getRootNode()) {

diff --git a/src/com/google/javascript/jscomp/MakeDeclaredNamesUnique.java b/src/com/google/javascript/jscomp/MakeDeclaredNamesUnique.java
index d88520cb..e4f1c205 100644
--- a/src/com/google/javascript/jscomp/MakeDeclaredNamesUnique.java
+++ b/src/com/google/javascript/jscomp/MakeDeclaredNamesUnique.java
@@ -23,7 +23,7 @@ import com.google.common.collect.Lists;

 
     private ContextualRenameInverter(AbstractCompiler compiler) {
       this.compiler = compiler;
@@ -266,105 +263,86 @@ class MakeDeclaredNamesUnique
     private boolean containsSeparator(String name) {
       return name.indexOf(ContextualRenamer.UNIQUE_ID_SEPARATOR) != -1;
     }
+    private static String getOrginalNameInternal(String name, int index) {
+      return name.substring(0, index);
+    }
 
     /**
      * Prepare a set for the new scope.
