docs: private void writeJsTo(Writer writer) throws IOException {
          Compiler compiler;
          CompilerOptions options;
          List<SourceFile> externals;
          List<SourceFile> sources;
          Result result;
          boolean first;
          int i;
          Node node;
  
          compiler = new Compiler(new LoggerErrorManager());
          options = new CompilerOptions();
          options.setOutputCharset(Engine.ENCODING);
          sources = new ArrayList<>();
          externals = new ArrayList<>();
          for (i = 0; i < nodes.size(); i++) {
              node = nodes.get(i);
              sources.add(SourceFile.fromCode(location(node)
                      + /* to get unique names, which is checked by the compiler: */ "_" + i, readString(node)));
          }
          result = compiler.compile(externals, sources, options);
          if (!result.success) {
              if (result.errors.length < 1) {
                  throw new IllegalStateException();
              }
              throw new IOException(result.errors[0].sourceName + ":" + result.errors[0].lineNumber + ":" + result.errors[0].description);
          }
          if (overallMinimize) {
              writer.write(compiler.toSource());
          } else {
              first = true;
              for (SourceFile source : sources) {
                  if (first) {
                      first = false;
                  } else {
                      writer.write(LF);
                  }
                  if (!overallMinimize) {
                      writer.write(type.comment(source.getName()));
                  }
                  writer.write(source.getCode());
              }
          }
      }