code: final void checkChildScope(S parent) {
      checkNotNull(parent);
      checkArgument(NodeUtil.createsScope(rootNode), rootNode);
      checkArgument(
          rootNode != parent.getRootNode(),
          "rootNode should not be the parent's root node: %s", rootNode);
    }
docs: Performs simple validity checks on when constructing a child scope.