From cc05df412e9a6f38ca25a1235b4844efcae484a6 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Mon, 21 Jan 2013 01:08:28 +0000 Subject: [PATCH] Fixed: objjc didn't print some errors. Before this fix, certain errors during compilation such as not being able to load a file, would cause the compilation to fail without stating what went wrong. This fix prints such errors and avoids crashing later when the result of the compilation is undefined. --- .../CommonJS/lib/objective-j/compiler.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Objective-J/CommonJS/lib/objective-j/compiler.js b/Objective-J/CommonJS/lib/objective-j/compiler.js index 2c7d582b9..377685877 100644 --- a/Objective-J/CommonJS/lib/objective-j/compiler.js +++ b/Objective-J/CommonJS/lib/objective-j/compiler.js @@ -101,7 +101,10 @@ function compileWithResolvedFlags(aFilePath, objjcFlags, gccFlags, asPlainJavasc delete document; } catch (anException) - {} + { + print(anException); + return; + } if (shouldCompress) { @@ -249,10 +252,14 @@ exports.main = function(args) print("Statically Compiling " + filePath); var output = compileWithResolvedFlags(filePath, objjcFlags, gccFlags, asPlainJavascript); - if (shouldPrintOutput) - print(output); - else - FILE.write(outputFilePaths[index], output, { charset: "UTF-8" }); + // Only write the output if the compilation didn't fail. + if (output !== undefined) + { + if (shouldPrintOutput) + print(output); + else + FILE.write(outputFilePaths[index], output, { charset: "UTF-8" }); + } }); };