code: private static String toSource(
        Node root,
        Format outputFormat,
        CompilerOptions options,
        SourceMap sourceMap,
        boolean tagAsTypeSummary,
        boolean tagAsStrict,
        boolean lineBreak,
        CodeGeneratorFactory codeGeneratorFactory) {
      checkState(options.sourceMapDetailLevel != null);
  
      boolean createSourceMap = (sourceMap != null);
      MappedCodePrinter mcp =
          outputFormat == Format.COMPACT
          ? new CompactCodePrinter(
              lineBreak,
              options.preferLineBreakAtEndOfFile,
              options.lineLengthThreshold,
              createSourceMap,
              options.sourceMapDetailLevel)
          : new PrettyCodePrinter(
              options.lineLengthThreshold,
              createSourceMap,
              options.sourceMapDetailLevel);
      CodeGenerator cg = codeGeneratorFactory.getCodeGenerator(outputFormat, mcp);
  
      if (tagAsTypeSummary) {
        cg.tagAsTypeSummary();
      }
      if (tagAsStrict) {
        cg.tagAsStrict();
      }
  
      cg.add(root);
      mcp.endFile();
  
      String code = mcp.getCode();
  
      if (createSourceMap) {
        mcp.generateSourceMap(code, sourceMap);
      }
  
      return code;
    }
docs: Converts a tree to JS code