Small correction: Module bodies are also scope roots.
@@ -2546,7 +2546,7 @@ public final class NodeUtil {
static final Predicate<Node> createsScope = new Predicate<Node>() {
@Override
public boolean apply(Node n) {
- return createsBlockScope(n) || n.isFunction()
+ return createsBlockScope(n) || n.isFunction() || n.isModuleBody()
// The ROOT nodes that are the root of the externs tree or main JS tree do not
// create scopes. The parent of those two, which is the root of the entire AST and
// therefore has no parent, is the only ROOT node that creates a scope.
