code: public static void deleteNode(Node n, AbstractCompiler compiler) {
      Node parent = n.getParent();
      NodeUtil.markFunctionsDeleted(n, compiler);
      n.detach();
      compiler.reportChangeToEnclosingScope(parent);
    }
docs: Permanently delete the given node from the AST, as well as report
  the related AST changes/deletions to the given compiler.