Skip to content

Commit

Permalink
Always traverse the FUNCTION node in renameNamespaceShadows() of Scop…
Browse files Browse the repository at this point in the history
…edAliases

-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=99189788
  • Loading branch information
Dominator008 authored and blickly committed Jul 27, 2015
1 parent 9239945 commit 739e2b1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/com/google/javascript/jscomp/ScopedAliases.java
Expand Up @@ -538,7 +538,13 @@ private void renameNamespaceShadows(NodeTraversal t) {
}
MakeDeclaredNamesUnique uniquifier =
new MakeDeclaredNamesUnique(renamer);
NodeTraversal.traverse(compiler, t.getScopeRoot(), uniquifier);
Node scopeRoot = t.getScopeRoot();
// If in ES6 mode, pass the FUNCTION node as root for traversal to meet
// MakeDeclaredNamesUnique's assumption.
if (scopeRoot.isBlock() && scopeRoot.getParent().isFunction()) {
scopeRoot = scopeRoot.getParent();
}
NodeTraversal.traverse(compiler, scopeRoot, uniquifier);
}
}

Expand Down

0 comments on commit 739e2b1

Please sign in to comment.