private static void generateJavaScriptCode(JJSOptions options,
JsProgram jsProgram, JavaToJavaScriptMap jjsMap, String[] js,
StatementRanges[] ranges, SizeBreakdown[] sizeBreakdowns,
List<Map<Range, SourceInfo>> sourceInfoMaps, boolean splitBlocks) {
for (int i = 0; i < js.length; i++) {
DefaultTextOutput out = new DefaultTextOutput(
options.getOutput().shouldMinimize());
JsSourceGenerationVisitorWithSizeBreakdown v;
if (sourceInfoMaps != null) {
v = new JsReportGenerationVisitor(out, jjsMap);
} else {
v = new JsSourceGenerationVisitorWithSizeBreakdown(out, jjsMap);
}
v.accept(jsProgram.getFragmentBlock(i));
/**
* Reorder function decls to improve compression ratios. Also restructures
* the top level blocks into sub-blocks if they exceed 32767 statements.
*/
JsFunctionClusterer clusterer = new JsFunctionClusterer(out.toString(),
v.getStatementRanges());
// only cluster for obfuscated mode
if (options.getOutput() == JsOutputOption.OBFUSCATED) {
clusterer.exec();
}