code: private void addNonEmptyStatement(
        Node n, Context context, boolean allowNonBlockChild) {
      Node nodeToProcess = n;
  
      if (!allowNonBlockChild && !n.isBlock()) {
        throw new Error("Missing BLOCK child.");
      }
  
      // Strip unneeded blocks, that is blocks with <2 children unless
      // the CodePrinter specifically wants to keep them.
      if (n.isBlock()) {
        int count = getNonEmptyChildCount(n, 2);
        if (count == 0) {
          if (cc.shouldPreserveExtraBlocks()) {
            cc.beginBlock();
            cc.endBlock(cc.breakAfterBlockFor(n, context == Context.STATEMENT));
          } else {
            cc.endStatement(true);
          }
          return;
        }
  
        if (count == 1) {
          // Preserve the block only if needed or requested.
          //'let', 'const', etc are not allowed by themselves in "if" and other
          // structures. Also, hack around a IE6/7 browser bug that needs a block around DOs.
          Node firstAndOnlyChild = getFirstNonEmptyChild(n);
          boolean alwaysWrapInBlock = cc.shouldPreserveExtraBlocks();
          if (alwaysWrapInBlock || isBlockDeclOrDo(firstAndOnlyChild)) {
            cc.beginBlock();
            add(firstAndOnlyChild, Context.STATEMENT);
            cc.maybeLineBreak();
            cc.endBlock(cc.breakAfterBlockFor(n, context == Context.STATEMENT));
            return;
          } else {
            // Continue with the only child.
            nodeToProcess = firstAndOnlyChild;
          }
        }
      }
  
      if (nodeToProcess.isEmpty()) {
        cc.endStatement(true);
      } else {
        add(nodeToProcess, context);
      }
    }
docs: Adds a block or expression, substituting a VOID with an empty statement.
  This is used for "for (...);" and "if (...);" type statements.
  
  @param n The node to print.
  @param context The context to determine how the node should be printed.