private CompilationUnitSinkFactory createSinkFactory(JoocConfiguration config, final boolean generateActionScriptApi) {
CompilationUnitSinkFactory codeSinkFactory;
if (!generateActionScriptApi && config.isMergeOutput()) {
codeSinkFactory = new MergedOutputCompilationUnitSinkFactory(
config, config.getOutputFile()
);
} else {
File outputDirectory = generateActionScriptApi ? config.getApiOutputDirectory() : config.getOutputDirectory();
final String suffix = generateActionScriptApi ? AS_SUFFIX : OUTPUT_FILE_SUFFIX;