code: @Nullable
    private Node getGoogModuleScopeRoot(@Nullable Module module) {
      checkArgument(module.metadata().isGoogModule(), module.metadata());
      Node scriptNode = module.metadata().rootNode();
  
      if (scriptNode.isScript()
          && scriptNode.hasOneChild()
          && scriptNode.getOnlyChild().isModuleBody()) {
        // The module root node should be a SCRIPT, whose first child is a MODULE_BODY.
        // The map is keyed off a MODULE_BODY node for a goog.module,
        // which is the only child of our SCRIPT node.
        return scriptNode.getOnlyChild();
      } else if (scriptNode.isCall()) {
        // This is a goog.loadModule call, and the scope is keyed off the FUNCTION node's BLOCK in:
        //   goog.loadModule(function(exports)
        Node functionLiteral = scriptNode.getSecondChild();
        return NodeUtil.getFunctionBody(functionLiteral);
      }
      // TODO(b/124919359): this case should not happen, but is triggering on goog.require calls in
      // rewritten modules with preserveClosurePrimitives enabled.
      return null;
    }
docs: Returns the corresponding scope root Node from a goog.module.