Allow for let and const to be modified as well as var.
This is in preparation for switching this pass to the ES6 scope creator.
@@ -413,13 +413,13 @@ class InlineVariables implements CompilerPass {
*/
private void removeDeclaration(Reference decl) {
Node varNode = decl.getParent();
+ Preconditions.checkState(NodeUtil.isNameDeclaration(varNode), varNode);
Node grandparent = decl.getGrandparent();
compiler.reportChangeToEnclosingScope(decl.getNode());
varNode.removeChild(decl.getNode());
// Remove var node if empty
if (!varNode.hasChildren()) {
- Preconditions.checkState(varNode.isVar());
NodeUtil.removeChild(grandparent, varNode);
}
}
