mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-01-01 13:30:50 +00:00
Improved compiler errors - removing exception trace and using proper exit code.
This commit is contained in:
parent
6adb0c6d2d
commit
fa6ed8bff6
@ -134,8 +134,6 @@ public class Compiler {
|
|||||||
pass5GenerateAndOptimizeAsm();
|
pass5GenerateAndOptimizeAsm();
|
||||||
return program;
|
return program;
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
System.out.println("EXCEPTION DURING COMPILE " + e.getMessage());
|
|
||||||
System.out.println(getLog().toString());
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,9 @@ public class KickC implements Callable<Void> {
|
|||||||
@CommandLine.Option(names = {"-fragment" }, description = "Print the ASM code for a named fragment. The fragment is loaded/synthesized and the ASM variations are written to the output.")
|
@CommandLine.Option(names = {"-fragment" }, description = "Print the ASM code for a named fragment. The fragment is loaded/synthesized and the ASM variations are written to the output.")
|
||||||
private String fragment = null;
|
private String fragment = null;
|
||||||
|
|
||||||
|
/** Program Exit Code signaling a compile error. */
|
||||||
|
public static final int COMPILE_ERROR = 1;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
CommandLine.call(new KickC(), args);
|
CommandLine.call(new KickC(), args);
|
||||||
}
|
}
|
||||||
@ -156,7 +159,14 @@ public class KickC implements Callable<Void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Compiling " + kcFile);
|
System.out.println("Compiling " + kcFile);
|
||||||
Program program = compiler.compile(kcFile.toString());
|
Program program = null;
|
||||||
|
try {
|
||||||
|
program = compiler.compile(kcFile.toString());
|
||||||
|
} catch(CompileError e) {
|
||||||
|
// Print the error and exit with compile error
|
||||||
|
System.err.print(e.getMessage());
|
||||||
|
System.exit(COMPILE_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
Path asmPath = outputDir.resolve(asmFileName);
|
Path asmPath = outputDir.resolve(asmFileName);
|
||||||
System.out.println("Writing asm file " + asmPath);
|
System.out.println("Writing asm file " + asmPath);
|
||||||
|
Loading…
Reference in New Issue
Block a user