Small correction to a preconditions check:
MakeDeclaredNamesUnique requires an ES6-compatible ScopeCreator but it need not be an Es6SyntacticScopeCreator. It can (and will in an upcoming CL) be a MemoizedScopeCreator
@@ -80,8 +80,10 @@ class MakeDeclaredNamesUnique implements NodeTraversal.ScopedCallback {
@Override
public void enterScope(NodeTraversal t) {
- checkState(t.getScopeCreator() instanceof Es6SyntacticScopeCreator,
- "MakeDeclaredNamesUnique requires the new ES6-compatible scope creator");
+ checkState(
+ t.getScopeCreator().hasBlockScope(),
+ "MakeDeclaredNamesUnique requires an ES6-compatible scope creator. %s is not compatible.",
+ t.getScopeCreator());
Node declarationRoot = t.getScopeRoot();
// Function bodies are handled along with PARAM_LIST
if (NodeUtil.isFunctionBlock(declarationRoot)) {
