private static void compileFiles(CompileContext context, Module module, List<VirtualFile> toCompile,
OutputSink sink, boolean tests) {
if (CompilerLocation.get(module) == null)
return; // todo: produce error
VirtualFile outputDir = getMainOutput(context, module, tests);
List<OutputItem> output = new ArrayList<OutputItem>();
// todo: pass all files to compiler at once (more effective?)
for (VirtualFile file : toCompile) {
for (GHCMessage message : LaunchGHC.compile(outputDir, file.getPath(), module, tests)) {
VirtualFile errFile = LocalFileSystem.getInstance().findFileByPath(message.getFileName());
String url = errFile == null ? message.getFileName() : errFile.getUrl();
LineCol coord = message.getRange().start;
context.addMessage(
message.getCategory(), message.getErrorMessage(),
url,
coord.line, coord.column